暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

onenote-web-16.00.debug.js 557KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282
  1. /* OneNote specific JavaScript API library */
  2. /* Version: 16.0.7607.3000 */
  3. /*
  4. Copyright (c) Microsoft Corporation. All rights reserved.
  5. */
  6. /*
  7. Your use of this file is governed by the Microsoft Services Agreement http://go.microsoft.com/fwlink/?LinkId=266419.
  8. */
  9. /*
  10. * @overview es6-promise - a tiny implementation of Promises/A+.
  11. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  12. * @license Licensed under MIT license
  13. * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
  14. * @version 2.3.0
  15. */
  16. var __extends=(this && this.__extends) || function (d, b) {
  17. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  18. function __() { this.constructor=d; }
  19. d.prototype=b===null ? Object.create(b) : (__.prototype=b.prototype, new __());
  20. };
  21. var OfficeExt;
  22. (function (OfficeExt) {
  23. var MicrosoftAjaxFactory=(function () {
  24. function MicrosoftAjaxFactory() {
  25. }
  26. MicrosoftAjaxFactory.prototype.isMsAjaxLoaded=function () {
  27. if (typeof (Sys) !=='undefined' && typeof (Type) !=='undefined' &&
  28. Sys.StringBuilder && typeof (Sys.StringBuilder)==="function" &&
  29. Type.registerNamespace && typeof (Type.registerNamespace)==="function" &&
  30. Type.registerClass && typeof (Type.registerClass)==="function" &&
  31. typeof (Function._validateParams)==="function" &&
  32. Sys.Serialization && Sys.Serialization.JavaScriptSerializer && typeof (Sys.Serialization.JavaScriptSerializer.serialize)==="function") {
  33. return true;
  34. }
  35. else {
  36. return false;
  37. }
  38. };
  39. MicrosoftAjaxFactory.prototype.loadMsAjaxFull=function (callback) {
  40. var msAjaxCDNPath=(window.location.protocol.toLowerCase()==='https:' ? 'https:' : 'http:')+'//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js';
  41. OSF.OUtil.loadScript(msAjaxCDNPath, callback);
  42. };
  43. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxError", {
  44. get: function () {
  45. if (this._msAjaxError==null && this.isMsAjaxLoaded()) {
  46. this._msAjaxError=Error;
  47. }
  48. return this._msAjaxError;
  49. },
  50. set: function (errorClass) {
  51. this._msAjaxError=errorClass;
  52. },
  53. enumerable: true,
  54. configurable: true
  55. });
  56. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxString", {
  57. get: function () {
  58. if (this._msAjaxString==null && this.isMsAjaxLoaded()) {
  59. this._msAjaxString=String;
  60. }
  61. return this._msAjaxString;
  62. },
  63. set: function (stringClass) {
  64. this._msAjaxString=stringClass;
  65. },
  66. enumerable: true,
  67. configurable: true
  68. });
  69. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxDebug", {
  70. get: function () {
  71. if (this._msAjaxDebug==null && this.isMsAjaxLoaded()) {
  72. this._msAjaxDebug=Sys.Debug;
  73. }
  74. return this._msAjaxDebug;
  75. },
  76. set: function (debugClass) {
  77. this._msAjaxDebug=debugClass;
  78. },
  79. enumerable: true,
  80. configurable: true
  81. });
  82. return MicrosoftAjaxFactory;
  83. })();
  84. OfficeExt.MicrosoftAjaxFactory=MicrosoftAjaxFactory;
  85. })(OfficeExt || (OfficeExt={}));
  86. var OsfMsAjaxFactory=new OfficeExt.MicrosoftAjaxFactory();
  87. var OSF=OSF || {};
  88. var OfficeExt;
  89. (function (OfficeExt) {
  90. var SafeStorage=(function () {
  91. function SafeStorage(_internalStorage) {
  92. this._internalStorage=_internalStorage;
  93. }
  94. SafeStorage.prototype.getItem=function (key) {
  95. try {
  96. return this._internalStorage && this._internalStorage.getItem(key);
  97. }
  98. catch (e) {
  99. return null;
  100. }
  101. };
  102. SafeStorage.prototype.setItem=function (key, data) {
  103. try {
  104. this._internalStorage && this._internalStorage.setItem(key, data);
  105. }
  106. catch (e) {
  107. }
  108. };
  109. SafeStorage.prototype.clear=function () {
  110. try {
  111. this._internalStorage && this._internalStorage.clear();
  112. }
  113. catch (e) {
  114. }
  115. };
  116. SafeStorage.prototype.removeItem=function (key) {
  117. try {
  118. this._internalStorage && this._internalStorage.removeItem(key);
  119. }
  120. catch (e) {
  121. }
  122. };
  123. SafeStorage.prototype.getKeysWithPrefix=function (keyPrefix) {
  124. var keyList=[];
  125. try {
  126. var len=this._internalStorage && this._internalStorage.length || 0;
  127. for (var i=0; i < len; i++) {
  128. var key=this._internalStorage.key(i);
  129. if (key.indexOf(keyPrefix)===0) {
  130. keyList.push(key);
  131. }
  132. }
  133. }
  134. catch (e) {
  135. }
  136. return keyList;
  137. };
  138. return SafeStorage;
  139. })();
  140. OfficeExt.SafeStorage=SafeStorage;
  141. })(OfficeExt || (OfficeExt={}));
  142. OSF.XdmFieldName={
  143. ConversationUrl: "ConversationUrl",
  144. AppId: "AppId"
  145. };
  146. OSF.WindowNameItemKeys={
  147. BaseFrameName: "baseFrameName",
  148. HostInfo: "hostInfo",
  149. XdmInfo: "xdmInfo",
  150. SerializerVersion: "serializerVersion",
  151. AppContext: "appContext"
  152. };
  153. OSF.OUtil=(function () {
  154. var _uniqueId=-1;
  155. var _xdmInfoKey='&_xdm_Info=';
  156. var _serializerVersionKey='&_serializer_version=';
  157. var _xdmSessionKeyPrefix='_xdm_';
  158. var _serializerVersionKeyPrefix='_serializer_version=';
  159. var _fragmentSeparator='#';
  160. var _fragmentInfoDelimiter='&';
  161. var _classN="class";
  162. var _loadedScripts={};
  163. var _defaultScriptLoadingTimeout=30000;
  164. var _safeSessionStorage=null;
  165. var _safeLocalStorage=null;
  166. var _rndentropy=new Date().getTime();
  167. function _random() {
  168. var nextrand=0x7fffffff * (Math.random());
  169. nextrand ^=_rndentropy ^ ((new Date().getMilliseconds()) << Math.floor(Math.random() * (31 - 10)));
  170. return nextrand.toString(16);
  171. }
  172. ;
  173. function _getSessionStorage() {
  174. if (!_safeSessionStorage) {
  175. try {
  176. var sessionStorage=window.sessionStorage;
  177. }
  178. catch (ex) {
  179. sessionStorage=null;
  180. }
  181. _safeSessionStorage=new OfficeExt.SafeStorage(sessionStorage);
  182. }
  183. return _safeSessionStorage;
  184. }
  185. ;
  186. function _reOrderTabbableElements(elements) {
  187. var bucket0=[];
  188. var bucketPositive=[];
  189. var i;
  190. var len=elements.length;
  191. var ele;
  192. for (i=0; i < len; i++) {
  193. ele=elements[i];
  194. if (ele.tabIndex) {
  195. if (ele.tabIndex > 0) {
  196. bucketPositive.push(ele);
  197. }
  198. else if (ele.tabIndex===0) {
  199. bucket0.push(ele);
  200. }
  201. }
  202. else {
  203. bucket0.push(ele);
  204. }
  205. }
  206. bucketPositive=bucketPositive.sort(function (left, right) {
  207. var diff=left.tabIndex - right.tabIndex;
  208. if (diff===0) {
  209. diff=bucketPositive.indexOf(left) - bucketPositive.indexOf(right);
  210. }
  211. return diff;
  212. });
  213. return [].concat(bucketPositive, bucket0);
  214. }
  215. ;
  216. return {
  217. set_entropy: function OSF_OUtil$set_entropy(entropy) {
  218. if (typeof entropy=="string") {
  219. for (var i=0; i < entropy.length; i+=4) {
  220. var temp=0;
  221. for (var j=0; j < 4 && i+j < entropy.length; j++) {
  222. temp=(temp << 8)+entropy.charCodeAt(i+j);
  223. }
  224. _rndentropy ^=temp;
  225. }
  226. }
  227. else if (typeof entropy=="number") {
  228. _rndentropy ^=entropy;
  229. }
  230. else {
  231. _rndentropy ^=0x7fffffff * Math.random();
  232. }
  233. _rndentropy &=0x7fffffff;
  234. },
  235. extend: function OSF_OUtil$extend(child, parent) {
  236. var F=function () { };
  237. F.prototype=parent.prototype;
  238. child.prototype=new F();
  239. child.prototype.constructor=child;
  240. child.uber=parent.prototype;
  241. if (parent.prototype.constructor===Object.prototype.constructor) {
  242. parent.prototype.constructor=parent;
  243. }
  244. },
  245. setNamespace: function OSF_OUtil$setNamespace(name, parent) {
  246. if (parent && name && !parent[name]) {
  247. parent[name]={};
  248. }
  249. },
  250. unsetNamespace: function OSF_OUtil$unsetNamespace(name, parent) {
  251. if (parent && name && parent[name]) {
  252. delete parent[name];
  253. }
  254. },
  255. loadScript: function OSF_OUtil$loadScript(url, callback, timeoutInMs) {
  256. if (url && callback) {
  257. var doc=window.document;
  258. var _loadedScriptEntry=_loadedScripts[url];
  259. if (!_loadedScriptEntry) {
  260. var script=doc.createElement("script");
  261. script.type="text/javascript";
  262. _loadedScriptEntry={ loaded: false, pendingCallbacks: [callback], timer: null };
  263. _loadedScripts[url]=_loadedScriptEntry;
  264. var onLoadCallback=function OSF_OUtil_loadScript$onLoadCallback() {
  265. if (_loadedScriptEntry.timer !=null) {
  266. clearTimeout(_loadedScriptEntry.timer);
  267. delete _loadedScriptEntry.timer;
  268. }
  269. _loadedScriptEntry.loaded=true;
  270. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  271. for (var i=0; i < pendingCallbackCount; i++) {
  272. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  273. currentCallback();
  274. }
  275. };
  276. var onLoadError=function OSF_OUtil_loadScript$onLoadError() {
  277. delete _loadedScripts[url];
  278. if (_loadedScriptEntry.timer !=null) {
  279. clearTimeout(_loadedScriptEntry.timer);
  280. delete _loadedScriptEntry.timer;
  281. }
  282. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  283. for (var i=0; i < pendingCallbackCount; i++) {
  284. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  285. currentCallback();
  286. }
  287. };
  288. if (script.readyState) {
  289. script.onreadystatechange=function () {
  290. if (script.readyState=="loaded" || script.readyState=="complete") {
  291. script.onreadystatechange=null;
  292. onLoadCallback();
  293. }
  294. };
  295. }
  296. else {
  297. script.onload=onLoadCallback;
  298. }
  299. script.onerror=onLoadError;
  300. timeoutInMs=timeoutInMs || _defaultScriptLoadingTimeout;
  301. _loadedScriptEntry.timer=setTimeout(onLoadError, timeoutInMs);
  302. script.src=url;
  303. doc.getElementsByTagName("head")[0].appendChild(script);
  304. }
  305. else if (_loadedScriptEntry.loaded) {
  306. callback();
  307. }
  308. else {
  309. _loadedScriptEntry.pendingCallbacks.push(callback);
  310. }
  311. }
  312. },
  313. loadCSS: function OSF_OUtil$loadCSS(url) {
  314. if (url) {
  315. var doc=window.document;
  316. var link=doc.createElement("link");
  317. link.type="text/css";
  318. link.rel="stylesheet";
  319. link.href=url;
  320. doc.getElementsByTagName("head")[0].appendChild(link);
  321. }
  322. },
  323. parseEnum: function OSF_OUtil$parseEnum(str, enumObject) {
  324. var parsed=enumObject[str.trim()];
  325. if (typeof (parsed)=='undefined') {
  326. OsfMsAjaxFactory.msAjaxDebug.trace("invalid enumeration string:"+str);
  327. throw OsfMsAjaxFactory.msAjaxError.argument("str");
  328. }
  329. return parsed;
  330. },
  331. delayExecutionAndCache: function OSF_OUtil$delayExecutionAndCache() {
  332. var obj={ calc: arguments[0] };
  333. return function () {
  334. if (obj.calc) {
  335. obj.val=obj.calc.apply(this, arguments);
  336. delete obj.calc;
  337. }
  338. return obj.val;
  339. };
  340. },
  341. getUniqueId: function OSF_OUtil$getUniqueId() {
  342. _uniqueId=_uniqueId+1;
  343. return _uniqueId.toString();
  344. },
  345. formatString: function OSF_OUtil$formatString() {
  346. var args=arguments;
  347. var source=args[0];
  348. return source.replace(/{(\d+)}/gm, function (match, number) {
  349. var index=parseInt(number, 10)+1;
  350. return args[index]===undefined ? '{'+number+'}' : args[index];
  351. });
  352. },
  353. generateConversationId: function OSF_OUtil$generateConversationId() {
  354. return [_random(), _random(), (new Date()).getTime().toString()].join('_');
  355. },
  356. getFrameName: function OSF_OUtil$getFrameName(cacheKey) {
  357. return _xdmSessionKeyPrefix+cacheKey+this.generateConversationId();
  358. },
  359. addXdmInfoAsHash: function OSF_OUtil$addXdmInfoAsHash(url, xdmInfoValue) {
  360. return OSF.OUtil.addInfoAsHash(url, _xdmInfoKey, xdmInfoValue, false);
  361. },
  362. addSerializerVersionAsHash: function OSF_OUtil$addSerializerVersionAsHash(url, serializerVersion) {
  363. return OSF.OUtil.addInfoAsHash(url, _serializerVersionKey, serializerVersion, true);
  364. },
  365. addInfoAsHash: function OSF_OUtil$addInfoAsHash(url, keyName, infoValue, encodeInfo) {
  366. url=url.trim() || '';
  367. var urlParts=url.split(_fragmentSeparator);
  368. var urlWithoutFragment=urlParts.shift();
  369. var fragment=urlParts.join(_fragmentSeparator);
  370. var newFragment;
  371. if (encodeInfo) {
  372. newFragment=[keyName, encodeURIComponent(infoValue), fragment].join('');
  373. }
  374. else {
  375. newFragment=[fragment, keyName, infoValue].join('');
  376. }
  377. return [urlWithoutFragment, _fragmentSeparator, newFragment].join('');
  378. },
  379. parseHostInfoFromWindowName: function OSF_OUtil$parseHostInfoFromWindowName(skipSessionStorage, windowName) {
  380. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.HostInfo);
  381. },
  382. parseXdmInfo: function OSF_OUtil$parseXdmInfo(skipSessionStorage) {
  383. var xdmInfoValue=OSF.OUtil.parseXdmInfoWithGivenFragment(skipSessionStorage, window.location.hash);
  384. if (!xdmInfoValue) {
  385. xdmInfoValue=OSF.OUtil.parseXdmInfoFromWindowName(skipSessionStorage, window.name);
  386. }
  387. return xdmInfoValue;
  388. },
  389. parseXdmInfoFromWindowName: function OSF_OUtil$parseXdmInfoFromWindowName(skipSessionStorage, windowName) {
  390. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.XdmInfo);
  391. },
  392. parseXdmInfoWithGivenFragment: function OSF_OUtil$parseXdmInfoWithGivenFragment(skipSessionStorage, fragment) {
  393. return OSF.OUtil.parseInfoWithGivenFragment(_xdmInfoKey, _xdmSessionKeyPrefix, false, skipSessionStorage, fragment);
  394. },
  395. parseSerializerVersion: function OSF_OUtil$parseSerializerVersion(skipSessionStorage) {
  396. var serializerVersion=OSF.OUtil.parseSerializerVersionWithGivenFragment(skipSessionStorage, window.location.hash);
  397. if (isNaN(serializerVersion)) {
  398. serializerVersion=OSF.OUtil.parseSerializerVersionFromWindowName(skipSessionStorage, window.name);
  399. }
  400. return serializerVersion;
  401. },
  402. parseSerializerVersionFromWindowName: function OSF_OUtil$parseSerializerVersionFromWindowName(skipSessionStorage, windowName) {
  403. return parseInt(OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.SerializerVersion));
  404. },
  405. parseSerializerVersionWithGivenFragment: function OSF_OUtil$parseSerializerVersionWithGivenFragment(skipSessionStorage, fragment) {
  406. return parseInt(OSF.OUtil.parseInfoWithGivenFragment(_serializerVersionKey, _serializerVersionKeyPrefix, true, skipSessionStorage, fragment));
  407. },
  408. parseInfoFromWindowName: function OSF_OUtil$parseInfoFromWindowName(skipSessionStorage, windowName, infoKey) {
  409. try {
  410. var windowNameObj=JSON.parse(windowName);
  411. var infoValue=windowNameObj !=null ? windowNameObj[infoKey] : null;
  412. var osfSessionStorage=_getSessionStorage();
  413. if (!skipSessionStorage && osfSessionStorage && windowNameObj !=null) {
  414. var sessionKey=windowNameObj[OSF.WindowNameItemKeys.BaseFrameName]+infoKey;
  415. if (infoValue) {
  416. osfSessionStorage.setItem(sessionKey, infoValue);
  417. }
  418. else {
  419. infoValue=osfSessionStorage.getItem(sessionKey);
  420. }
  421. }
  422. return infoValue;
  423. }
  424. catch (Exception) {
  425. return null;
  426. }
  427. },
  428. parseInfoWithGivenFragment: function OSF_OUtil$parseInfoWithGivenFragment(infoKey, infoKeyPrefix, decodeInfo, skipSessionStorage, fragment) {
  429. var fragmentParts=fragment.split(infoKey);
  430. var infoValue=fragmentParts.length > 1 ? fragmentParts[fragmentParts.length - 1] : null;
  431. if (decodeInfo && infoValue !=null) {
  432. if (infoValue.indexOf(_fragmentInfoDelimiter) >=0) {
  433. infoValue=infoValue.split(_fragmentInfoDelimiter)[0];
  434. }
  435. infoValue=decodeURIComponent(infoValue);
  436. }
  437. var osfSessionStorage=_getSessionStorage();
  438. if (!skipSessionStorage && osfSessionStorage) {
  439. var sessionKeyStart=window.name.indexOf(infoKeyPrefix);
  440. if (sessionKeyStart > -1) {
  441. var sessionKeyEnd=window.name.indexOf(";", sessionKeyStart);
  442. if (sessionKeyEnd==-1) {
  443. sessionKeyEnd=window.name.length;
  444. }
  445. var sessionKey=window.name.substring(sessionKeyStart, sessionKeyEnd);
  446. if (infoValue) {
  447. osfSessionStorage.setItem(sessionKey, infoValue);
  448. }
  449. else {
  450. infoValue=osfSessionStorage.getItem(sessionKey);
  451. }
  452. }
  453. }
  454. return infoValue;
  455. },
  456. getConversationId: function OSF_OUtil$getConversationId() {
  457. var searchString=window.location.search;
  458. var conversationId=null;
  459. if (searchString) {
  460. var index=searchString.indexOf("&");
  461. conversationId=index > 0 ? searchString.substring(1, index) : searchString.substr(1);
  462. if (conversationId && conversationId.charAt(conversationId.length - 1)==='=') {
  463. conversationId=conversationId.substring(0, conversationId.length - 1);
  464. if (conversationId) {
  465. conversationId=decodeURIComponent(conversationId);
  466. }
  467. }
  468. }
  469. return conversationId;
  470. },
  471. getInfoItems: function OSF_OUtil$getInfoItems(strInfo) {
  472. var items=strInfo.split("$");
  473. if (typeof items[1]=="undefined") {
  474. items=strInfo.split("|");
  475. }
  476. if (typeof items[1]=="undefined") {
  477. items=strInfo.split("%7C");
  478. }
  479. return items;
  480. },
  481. getXdmFieldValue: function OSF_OUtil$getXdmFieldValue(xdmFieldName, skipSessionStorage) {
  482. var fieldValue='';
  483. var xdmInfoValue=OSF.OUtil.parseXdmInfo(skipSessionStorage);
  484. if (xdmInfoValue) {
  485. var items=OSF.OUtil.getInfoItems(xdmInfoValue);
  486. if (items !=undefined && items.length >=3) {
  487. switch (xdmFieldName) {
  488. case OSF.XdmFieldName.ConversationUrl:
  489. fieldValue=items[2];
  490. break;
  491. case OSF.XdmFieldName.AppId:
  492. fieldValue=items[1];
  493. break;
  494. }
  495. }
  496. }
  497. return fieldValue;
  498. },
  499. validateParamObject: function OSF_OUtil$validateParamObject(params, expectedProperties, callback) {
  500. var e=Function._validateParams(arguments, [{ name: "params", type: Object, mayBeNull: false },
  501. { name: "expectedProperties", type: Object, mayBeNull: false },
  502. { name: "callback", type: Function, mayBeNull: true }
  503. ]);
  504. if (e)
  505. throw e;
  506. for (var p in expectedProperties) {
  507. e=Function._validateParameter(params[p], expectedProperties[p], p);
  508. if (e)
  509. throw e;
  510. }
  511. },
  512. writeProfilerMark: function OSF_OUtil$writeProfilerMark(text) {
  513. if (window.msWriteProfilerMark) {
  514. window.msWriteProfilerMark(text);
  515. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  516. }
  517. },
  518. outputDebug: function OSF_OUtil$outputDebug(text) {
  519. if (typeof (OsfMsAjaxFactory) !=='undefined' && OsfMsAjaxFactory.msAjaxDebug && OsfMsAjaxFactory.msAjaxDebug.trace) {
  520. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  521. }
  522. },
  523. defineNondefaultProperty: function OSF_OUtil$defineNondefaultProperty(obj, prop, descriptor, attributes) {
  524. descriptor=descriptor || {};
  525. for (var nd in attributes) {
  526. var attribute=attributes[nd];
  527. if (descriptor[attribute]==undefined) {
  528. descriptor[attribute]=true;
  529. }
  530. }
  531. Object.defineProperty(obj, prop, descriptor);
  532. return obj;
  533. },
  534. defineNondefaultProperties: function OSF_OUtil$defineNondefaultProperties(obj, descriptors, attributes) {
  535. descriptors=descriptors || {};
  536. for (var prop in descriptors) {
  537. OSF.OUtil.defineNondefaultProperty(obj, prop, descriptors[prop], attributes);
  538. }
  539. return obj;
  540. },
  541. defineEnumerableProperty: function OSF_OUtil$defineEnumerableProperty(obj, prop, descriptor) {
  542. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["enumerable"]);
  543. },
  544. defineEnumerableProperties: function OSF_OUtil$defineEnumerableProperties(obj, descriptors) {
  545. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["enumerable"]);
  546. },
  547. defineMutableProperty: function OSF_OUtil$defineMutableProperty(obj, prop, descriptor) {
  548. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["writable", "enumerable", "configurable"]);
  549. },
  550. defineMutableProperties: function OSF_OUtil$defineMutableProperties(obj, descriptors) {
  551. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["writable", "enumerable", "configurable"]);
  552. },
  553. finalizeProperties: function OSF_OUtil$finalizeProperties(obj, descriptor) {
  554. descriptor=descriptor || {};
  555. var props=Object.getOwnPropertyNames(obj);
  556. var propsLength=props.length;
  557. for (var i=0; i < propsLength; i++) {
  558. var prop=props[i];
  559. var desc=Object.getOwnPropertyDescriptor(obj, prop);
  560. if (!desc.get && !desc.set) {
  561. desc.writable=descriptor.writable || false;
  562. }
  563. desc.configurable=descriptor.configurable || false;
  564. desc.enumerable=descriptor.enumerable || true;
  565. Object.defineProperty(obj, prop, desc);
  566. }
  567. return obj;
  568. },
  569. mapList: function OSF_OUtil$MapList(list, mapFunction) {
  570. var ret=[];
  571. if (list) {
  572. for (var item in list) {
  573. ret.push(mapFunction(list[item]));
  574. }
  575. }
  576. return ret;
  577. },
  578. listContainsKey: function OSF_OUtil$listContainsKey(list, key) {
  579. for (var item in list) {
  580. if (key==item) {
  581. return true;
  582. }
  583. }
  584. return false;
  585. },
  586. listContainsValue: function OSF_OUtil$listContainsElement(list, value) {
  587. for (var item in list) {
  588. if (value==list[item]) {
  589. return true;
  590. }
  591. }
  592. return false;
  593. },
  594. augmentList: function OSF_OUtil$augmentList(list, addenda) {
  595. var add=list.push ? function (key, value) { list.push(value); } : function (key, value) { list[key]=value; };
  596. for (var key in addenda) {
  597. add(key, addenda[key]);
  598. }
  599. },
  600. redefineList: function OSF_Outil$redefineList(oldList, newList) {
  601. for (var key1 in oldList) {
  602. delete oldList[key1];
  603. }
  604. for (var key2 in newList) {
  605. oldList[key2]=newList[key2];
  606. }
  607. },
  608. isArray: function OSF_OUtil$isArray(obj) {
  609. return Object.prototype.toString.apply(obj)==="[object Array]";
  610. },
  611. isFunction: function OSF_OUtil$isFunction(obj) {
  612. return Object.prototype.toString.apply(obj)==="[object Function]";
  613. },
  614. isDate: function OSF_OUtil$isDate(obj) {
  615. return Object.prototype.toString.apply(obj)==="[object Date]";
  616. },
  617. addEventListener: function OSF_OUtil$addEventListener(element, eventName, listener) {
  618. if (element.addEventListener) {
  619. element.addEventListener(eventName, listener, false);
  620. }
  621. else if ((Sys.Browser.agent===Sys.Browser.InternetExplorer) && element.attachEvent) {
  622. element.attachEvent("on"+eventName, listener);
  623. }
  624. else {
  625. element["on"+eventName]=listener;
  626. }
  627. },
  628. removeEventListener: function OSF_OUtil$removeEventListener(element, eventName, listener) {
  629. if (element.removeEventListener) {
  630. element.removeEventListener(eventName, listener, false);
  631. }
  632. else if ((Sys.Browser.agent===Sys.Browser.InternetExplorer) && element.detachEvent) {
  633. element.detachEvent("on"+eventName, listener);
  634. }
  635. else {
  636. element["on"+eventName]=null;
  637. }
  638. },
  639. getCookieValue: function OSF_OUtil$getCookieValue(cookieName) {
  640. var tmpCookieString=RegExp(cookieName+"[^;]+").exec(document.cookie);
  641. return tmpCookieString.toString().replace(/^[^=]+./, "");
  642. },
  643. xhrGet: function OSF_OUtil$xhrGet(url, onSuccess, onError) {
  644. var xmlhttp;
  645. try {
  646. xmlhttp=new XMLHttpRequest();
  647. xmlhttp.onreadystatechange=function () {
  648. if (xmlhttp.readyState==4) {
  649. if (xmlhttp.status==200) {
  650. onSuccess(xmlhttp.responseText);
  651. }
  652. else {
  653. onError(xmlhttp.status);
  654. }
  655. }
  656. };
  657. xmlhttp.open("GET", url, true);
  658. xmlhttp.send();
  659. }
  660. catch (ex) {
  661. onError(ex);
  662. }
  663. },
  664. xhrGetFull: function OSF_OUtil$xhrGetFull(url, oneDriveFileName, onSuccess, onError) {
  665. var xmlhttp;
  666. var requestedFileName=oneDriveFileName;
  667. try {
  668. xmlhttp=new XMLHttpRequest();
  669. xmlhttp.onreadystatechange=function () {
  670. if (xmlhttp.readyState==4) {
  671. if (xmlhttp.status==200) {
  672. onSuccess(xmlhttp, requestedFileName);
  673. }
  674. else {
  675. onError(xmlhttp.status);
  676. }
  677. }
  678. };
  679. xmlhttp.open("GET", url, true);
  680. xmlhttp.send();
  681. }
  682. catch (ex) {
  683. onError(ex);
  684. }
  685. },
  686. encodeBase64: function OSF_Outil$encodeBase64(input) {
  687. if (!input)
  688. return input;
  689. var codex="ABCDEFGHIJKLMNOP"+"QRSTUVWXYZabcdef"+"ghijklmnopqrstuv"+"wxyz0123456789+/=";
  690. var output=[];
  691. var temp=[];
  692. var index=0;
  693. var c1, c2, c3, a, b, c;
  694. var i;
  695. var length=input.length;
  696. do {
  697. c1=input.charCodeAt(index++);
  698. c2=input.charCodeAt(index++);
  699. c3=input.charCodeAt(index++);
  700. i=0;
  701. a=c1 & 255;
  702. b=c1 >> 8;
  703. c=c2 & 255;
  704. temp[i++]=a >> 2;
  705. temp[i++]=((a & 3) << 4) | (b >> 4);
  706. temp[i++]=((b & 15) << 2) | (c >> 6);
  707. temp[i++]=c & 63;
  708. if (!isNaN(c2)) {
  709. a=c2 >> 8;
  710. b=c3 & 255;
  711. c=c3 >> 8;
  712. temp[i++]=a >> 2;
  713. temp[i++]=((a & 3) << 4) | (b >> 4);
  714. temp[i++]=((b & 15) << 2) | (c >> 6);
  715. temp[i++]=c & 63;
  716. }
  717. if (isNaN(c2)) {
  718. temp[i - 1]=64;
  719. }
  720. else if (isNaN(c3)) {
  721. temp[i - 2]=64;
  722. temp[i - 1]=64;
  723. }
  724. for (var t=0; t < i; t++) {
  725. output.push(codex.charAt(temp[t]));
  726. }
  727. } while (index < length);
  728. return output.join("");
  729. },
  730. getSessionStorage: function OSF_Outil$getSessionStorage() {
  731. return _getSessionStorage();
  732. },
  733. getLocalStorage: function OSF_Outil$getLocalStorage() {
  734. if (!_safeLocalStorage) {
  735. try {
  736. var localStorage=window.localStorage;
  737. }
  738. catch (ex) {
  739. localStorage=null;
  740. }
  741. _safeLocalStorage=new OfficeExt.SafeStorage(localStorage);
  742. }
  743. return _safeLocalStorage;
  744. },
  745. convertIntToCssHexColor: function OSF_Outil$convertIntToCssHexColor(val) {
  746. var hex="#"+(Number(val)+0x1000000).toString(16).slice(-6);
  747. return hex;
  748. },
  749. attachClickHandler: function OSF_Outil$attachClickHandler(element, handler) {
  750. element.onclick=function (e) {
  751. handler();
  752. };
  753. element.ontouchend=function (e) {
  754. handler();
  755. e.preventDefault();
  756. };
  757. },
  758. getQueryStringParamValue: function OSF_Outil$getQueryStringParamValue(queryString, paramName) {
  759. var e=Function._validateParams(arguments, [{ name: "queryString", type: String, mayBeNull: false },
  760. { name: "paramName", type: String, mayBeNull: false }
  761. ]);
  762. if (e) {
  763. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: Parameters cannot be null.");
  764. return "";
  765. }
  766. var queryExp=new RegExp("[\\?&]"+paramName+"=([^&#]*)", "i");
  767. if (!queryExp.test(queryString)) {
  768. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: The parameter is not found.");
  769. return "";
  770. }
  771. return queryExp.exec(queryString)[1];
  772. },
  773. isiOS: function OSF_Outil$isiOS() {
  774. return (window.navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false);
  775. },
  776. isChrome: function OSF_Outil$isChrome() {
  777. return (window.navigator.userAgent.indexOf("Chrome") > 0) && !OSF.OUtil.isEdge();
  778. },
  779. isEdge: function OSF_Outil$isEdge() {
  780. return window.navigator.userAgent.indexOf("Edge") > 0;
  781. },
  782. isIE: function OSF_Outil$isIE() {
  783. return window.navigator.userAgent.indexOf("Trident") > 0;
  784. },
  785. isFirefox: function OSF_Outil$isFirefox() {
  786. return window.navigator.userAgent.indexOf("Firefox") > 0;
  787. },
  788. shallowCopy: function OSF_Outil$shallowCopy(sourceObj) {
  789. if (sourceObj==null) {
  790. return null;
  791. }
  792. else if (Array.isArray(sourceObj)) {
  793. var copyArr=[];
  794. for (var i=0; i < sourceObj.length; i++) {
  795. copyArr.push(sourceObj[i]);
  796. }
  797. return copyArr;
  798. }
  799. else {
  800. var copyObj=sourceObj.constructor();
  801. for (var property in sourceObj) {
  802. if (sourceObj.hasOwnProperty(property)) {
  803. copyObj[property]=sourceObj[property];
  804. }
  805. }
  806. return copyObj;
  807. }
  808. },
  809. createObject: function OSF_Outil$createObject(properties) {
  810. var obj=null;
  811. if (properties) {
  812. obj={};
  813. var len=properties.length;
  814. for (var i=0; i < len; i++) {
  815. obj[properties[i].name]=properties[i].value;
  816. }
  817. }
  818. return obj;
  819. },
  820. addClass: function OSF_OUtil$addClass(elmt, val) {
  821. if (!OSF.OUtil.hasClass(elmt, val)) {
  822. var className=elmt.getAttribute(_classN);
  823. if (className) {
  824. elmt.setAttribute(_classN, className+" "+val);
  825. }
  826. else {
  827. elmt.setAttribute(_classN, val);
  828. }
  829. }
  830. },
  831. hasClass: function OSF_OUtil$hasClass(elmt, clsName) {
  832. var className=elmt.getAttribute(_classN);
  833. return className && className.match(new RegExp('(\\s|^)'+clsName+'(\\s|$)'));
  834. },
  835. focusToFirstTabbable: function OSF_OUtil$focusToFirstTabbable(all, backward) {
  836. var next;
  837. var focused=false;
  838. var candidate;
  839. var setFlag=function (e) {
  840. focused=true;
  841. };
  842. var findNextPos=function (allLen, currPos, backward) {
  843. if (currPos < 0 || currPos > allLen) {
  844. return -1;
  845. }
  846. else if (currPos===0 && backward) {
  847. return -1;
  848. }
  849. else if (currPos===allLen - 1 && !backward) {
  850. return -1;
  851. }
  852. if (backward) {
  853. return currPos - 1;
  854. }
  855. else {
  856. return currPos+1;
  857. }
  858. };
  859. all=_reOrderTabbableElements(all);
  860. next=backward ? all.length - 1 : 0;
  861. if (all.length===0) {
  862. return null;
  863. }
  864. while (!focused && next >=0 && next < all.length) {
  865. candidate=all[next];
  866. window.focus();
  867. candidate.addEventListener('focus', setFlag);
  868. candidate.focus();
  869. candidate.removeEventListener('focus', setFlag);
  870. next=findNextPos(all.length, next, backward);
  871. if (!focused && candidate===document.activeElement) {
  872. focused=true;
  873. }
  874. }
  875. if (focused) {
  876. return candidate;
  877. }
  878. else {
  879. return null;
  880. }
  881. },
  882. focusToNextTabbable: function OSF_OUtil$focusToNextTabbable(all, curr, shift) {
  883. var currPos;
  884. var next;
  885. var focused=false;
  886. var candidate;
  887. var setFlag=function (e) {
  888. focused=true;
  889. };
  890. var findCurrPos=function (all, curr) {
  891. var i=0;
  892. for (; i < all.length; i++) {
  893. if (all[i]===curr) {
  894. return i;
  895. }
  896. }
  897. return -1;
  898. };
  899. var findNextPos=function (allLen, currPos, shift) {
  900. if (currPos < 0 || currPos > allLen) {
  901. return -1;
  902. }
  903. else if (currPos===0 && shift) {
  904. return -1;
  905. }
  906. else if (currPos===allLen - 1 && !shift) {
  907. return -1;
  908. }
  909. if (shift) {
  910. return currPos - 1;
  911. }
  912. else {
  913. return currPos+1;
  914. }
  915. };
  916. all=_reOrderTabbableElements(all);
  917. currPos=findCurrPos(all, curr);
  918. next=findNextPos(all.length, currPos, shift);
  919. if (next < 0) {
  920. return null;
  921. }
  922. while (!focused && next >=0 && next < all.length) {
  923. candidate=all[next];
  924. candidate.addEventListener('focus', setFlag);
  925. candidate.focus();
  926. candidate.removeEventListener('focus', setFlag);
  927. next=findNextPos(all.length, next, shift);
  928. if (!focused && candidate===document.activeElement) {
  929. focused=true;
  930. }
  931. }
  932. if (focused) {
  933. return candidate;
  934. }
  935. else {
  936. return null;
  937. }
  938. }
  939. };
  940. })();
  941. OSF.OUtil.Guid=(function () {
  942. var hexCode=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
  943. return {
  944. generateNewGuid: function OSF_Outil_Guid$generateNewGuid() {
  945. var result="";
  946. var tick=(new Date()).getTime();
  947. var index=0;
  948. for (; index < 32 && tick > 0; index++) {
  949. if (index==8 || index==12 || index==16 || index==20) {
  950. result+="-";
  951. }
  952. result+=hexCode[tick % 16];
  953. tick=Math.floor(tick / 16);
  954. }
  955. for (; index < 32; index++) {
  956. if (index==8 || index==12 || index==16 || index==20) {
  957. result+="-";
  958. }
  959. result+=hexCode[Math.floor(Math.random() * 16)];
  960. }
  961. return result;
  962. }
  963. };
  964. })();
  965. window.OSF=OSF;
  966. OSF.OUtil.setNamespace("OSF", window);
  967. OSF.AppName={
  968. Unsupported: 0,
  969. Excel: 1,
  970. Word: 2,
  971. PowerPoint: 4,
  972. Outlook: 8,
  973. ExcelWebApp: 16,
  974. WordWebApp: 32,
  975. OutlookWebApp: 64,
  976. Project: 128,
  977. AccessWebApp: 256,
  978. PowerpointWebApp: 512,
  979. ExcelIOS: 1024,
  980. Sway: 2048,
  981. WordIOS: 4096,
  982. PowerPointIOS: 8192,
  983. Access: 16384,
  984. Lync: 32768,
  985. OutlookIOS: 65536,
  986. OneNoteWebApp: 131072,
  987. OneNote: 262144,
  988. ExcelWinRT: 524288,
  989. WordWinRT: 1048576,
  990. PowerpointWinRT: 2097152,
  991. OutlookAndroid: 4194304,
  992. OneNoteWinRT: 8388608,
  993. ExcelAndroid: 8388609,
  994. VisioWebApp: 8388610
  995. };
  996. OSF.InternalPerfMarker={
  997. DataCoercionBegin: "Agave.HostCall.CoerceDataStart",
  998. DataCoercionEnd: "Agave.HostCall.CoerceDataEnd"
  999. };
  1000. OSF.HostCallPerfMarker={
  1001. IssueCall: "Agave.HostCall.IssueCall",
  1002. ReceiveResponse: "Agave.HostCall.ReceiveResponse",
  1003. RuntimeExceptionRaised: "Agave.HostCall.RuntimeExecptionRaised"
  1004. };
  1005. OSF.AgaveHostAction={
  1006. "Select": 0,
  1007. "UnSelect": 1,
  1008. "CancelDialog": 2,
  1009. "InsertAgave": 3,
  1010. "CtrlF6In": 4,
  1011. "CtrlF6Exit": 5,
  1012. "CtrlF6ExitShift": 6,
  1013. "SelectWithError": 7,
  1014. "NotifyHostError": 8,
  1015. "RefreshAddinCommands": 9,
  1016. "PageIsReady": 10,
  1017. "TabIn": 11,
  1018. "TabInShift": 12,
  1019. "TabExit": 13,
  1020. "TabExitShift": 14,
  1021. "EscExit": 15,
  1022. "F2Exit": 16,
  1023. "ExitNoFocusable": 17,
  1024. "ExitNoFocusableShift": 18
  1025. };
  1026. OSF.SharedConstants={
  1027. "NotificationConversationIdSuffix": '_ntf'
  1028. };
  1029. OSF.DialogMessageType={
  1030. DialogMessageReceived: 0,
  1031. DialogParentMessageReceived: 1,
  1032. DialogClosed: 12006
  1033. };
  1034. OSF.OfficeAppContext=function OSF_OfficeAppContext(id, appName, appVersion, appUILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, appMinorVersion, requirementMatrix, hostCustomMessage, hostFullVersion, clientWindowHeight, clientWindowWidth, addinName, appDomains, dialogRequirementMatrix) {
  1035. this._id=id;
  1036. this._appName=appName;
  1037. this._appVersion=appVersion;
  1038. this._appUILocale=appUILocale;
  1039. this._dataLocale=dataLocale;
  1040. this._docUrl=docUrl;
  1041. this._clientMode=clientMode;
  1042. this._settings=settings;
  1043. this._reason=reason;
  1044. this._osfControlType=osfControlType;
  1045. this._eToken=eToken;
  1046. this._correlationId=correlationId;
  1047. this._appInstanceId=appInstanceId;
  1048. this._touchEnabled=touchEnabled;
  1049. this._commerceAllowed=commerceAllowed;
  1050. this._appMinorVersion=appMinorVersion;
  1051. this._requirementMatrix=requirementMatrix;
  1052. this._hostCustomMessage=hostCustomMessage;
  1053. this._hostFullVersion=hostFullVersion;
  1054. this._isDialog=false;
  1055. this._clientWindowHeight=clientWindowHeight;
  1056. this._clientWindowWidth=clientWindowWidth;
  1057. this._addinName=addinName;
  1058. this._appDomains=appDomains;
  1059. this._dialogRequirementMatrix=dialogRequirementMatrix;
  1060. this.get_id=function get_id() { return this._id; };
  1061. this.get_appName=function get_appName() { return this._appName; };
  1062. this.get_appVersion=function get_appVersion() { return this._appVersion; };
  1063. this.get_appUILocale=function get_appUILocale() { return this._appUILocale; };
  1064. this.get_dataLocale=function get_dataLocale() { return this._dataLocale; };
  1065. this.get_docUrl=function get_docUrl() { return this._docUrl; };
  1066. this.get_clientMode=function get_clientMode() { return this._clientMode; };
  1067. this.get_bindings=function get_bindings() { return this._bindings; };
  1068. this.get_settings=function get_settings() { return this._settings; };
  1069. this.get_reason=function get_reason() { return this._reason; };
  1070. this.get_osfControlType=function get_osfControlType() { return this._osfControlType; };
  1071. this.get_eToken=function get_eToken() { return this._eToken; };
  1072. this.get_correlationId=function get_correlationId() { return this._correlationId; };
  1073. this.get_appInstanceId=function get_appInstanceId() { return this._appInstanceId; };
  1074. this.get_touchEnabled=function get_touchEnabled() { return this._touchEnabled; };
  1075. this.get_commerceAllowed=function get_commerceAllowed() { return this._commerceAllowed; };
  1076. this.get_appMinorVersion=function get_appMinorVersion() { return this._appMinorVersion; };
  1077. this.get_requirementMatrix=function get_requirementMatrix() { return this._requirementMatrix; };
  1078. this.get_dialogRequirementMatrix=function get_dialogRequirementMatrix() { return this._dialogRequirementMatrix; };
  1079. this.get_hostCustomMessage=function get_hostCustomMessage() { return this._hostCustomMessage; };
  1080. this.get_hostFullVersion=function get_hostFullVersion() { return this._hostFullVersion; };
  1081. this.get_isDialog=function get_isDialog() { return this._isDialog; };
  1082. this.get_clientWindowHeight=function get_clientWindowHeight() { return this._clientWindowHeight; };
  1083. this.get_clientWindowWidth=function get_clientWindowWidth() { return this._clientWindowWidth; };
  1084. this.get_addinName=function get_addinName() { return this._addinName; };
  1085. this.get_appDomains=function get_appDomains() { return this._appDomains; };
  1086. };
  1087. OSF.OsfControlType={
  1088. DocumentLevel: 0,
  1089. ContainerLevel: 1
  1090. };
  1091. OSF.ClientMode={
  1092. ReadOnly: 0,
  1093. ReadWrite: 1
  1094. };
  1095. OSF.OUtil.setNamespace("Microsoft", window);
  1096. OSF.OUtil.setNamespace("Office", Microsoft);
  1097. OSF.OUtil.setNamespace("Client", Microsoft.Office);
  1098. OSF.OUtil.setNamespace("WebExtension", Microsoft.Office);
  1099. Microsoft.Office.WebExtension.InitializationReason={
  1100. Inserted: "inserted",
  1101. DocumentOpened: "documentOpened"
  1102. };
  1103. Microsoft.Office.WebExtension.ValueFormat={
  1104. Unformatted: "unformatted",
  1105. Formatted: "formatted"
  1106. };
  1107. Microsoft.Office.WebExtension.FilterType={
  1108. All: "all"
  1109. };
  1110. Microsoft.Office.WebExtension.Parameters={
  1111. BindingType: "bindingType",
  1112. CoercionType: "coercionType",
  1113. ValueFormat: "valueFormat",
  1114. FilterType: "filterType",
  1115. Columns: "columns",
  1116. SampleData: "sampleData",
  1117. GoToType: "goToType",
  1118. SelectionMode: "selectionMode",
  1119. Id: "id",
  1120. PromptText: "promptText",
  1121. ItemName: "itemName",
  1122. FailOnCollision: "failOnCollision",
  1123. StartRow: "startRow",
  1124. StartColumn: "startColumn",
  1125. RowCount: "rowCount",
  1126. ColumnCount: "columnCount",
  1127. Callback: "callback",
  1128. AsyncContext: "asyncContext",
  1129. Data: "data",
  1130. Rows: "rows",
  1131. OverwriteIfStale: "overwriteIfStale",
  1132. FileType: "fileType",
  1133. EventType: "eventType",
  1134. Handler: "handler",
  1135. SliceSize: "sliceSize",
  1136. SliceIndex: "sliceIndex",
  1137. ActiveView: "activeView",
  1138. Status: "status",
  1139. Xml: "xml",
  1140. Namespace: "namespace",
  1141. Prefix: "prefix",
  1142. XPath: "xPath",
  1143. Text: "text",
  1144. ImageLeft: "imageLeft",
  1145. ImageTop: "imageTop",
  1146. ImageWidth: "imageWidth",
  1147. ImageHeight: "imageHeight",
  1148. TaskId: "taskId",
  1149. FieldId: "fieldId",
  1150. FieldValue: "fieldValue",
  1151. ServerUrl: "serverUrl",
  1152. ListName: "listName",
  1153. ResourceId: "resourceId",
  1154. ViewType: "viewType",
  1155. ViewName: "viewName",
  1156. GetRawValue: "getRawValue",
  1157. CellFormat: "cellFormat",
  1158. TableOptions: "tableOptions",
  1159. TaskIndex: "taskIndex",
  1160. ResourceIndex: "resourceIndex",
  1161. CustomFieldId: "customFieldId",
  1162. Url: "url",
  1163. MessageHandler: "messageHandler",
  1164. Width: "width",
  1165. Height: "height",
  1166. RequireHTTPs: "requireHTTPS",
  1167. MessageToParent: "messageToParent",
  1168. DisplayInIframe: "displayInIframe",
  1169. MessageContent: "messageContent"
  1170. };
  1171. OSF.OUtil.setNamespace("DDA", OSF);
  1172. OSF.DDA.DocumentMode={
  1173. ReadOnly: 1,
  1174. ReadWrite: 0
  1175. };
  1176. OSF.DDA.PropertyDescriptors={
  1177. AsyncResultStatus: "AsyncResultStatus"
  1178. };
  1179. OSF.DDA.EventDescriptors={};
  1180. OSF.DDA.ListDescriptors={};
  1181. OSF.DDA.UI={};
  1182. OSF.DDA.getXdmEventName=function OSF_DDA$GetXdmEventName(id, eventType) {
  1183. if (eventType==Microsoft.Office.WebExtension.EventType.BindingSelectionChanged ||
  1184. eventType==Microsoft.Office.WebExtension.EventType.BindingDataChanged ||
  1185. eventType==Microsoft.Office.WebExtension.EventType.DataNodeDeleted ||
  1186. eventType==Microsoft.Office.WebExtension.EventType.DataNodeInserted ||
  1187. eventType==Microsoft.Office.WebExtension.EventType.DataNodeReplaced) {
  1188. return id+"_"+eventType;
  1189. }
  1190. else {
  1191. return eventType;
  1192. }
  1193. };
  1194. OSF.DDA.MethodDispId={
  1195. dispidMethodMin: 64,
  1196. dispidGetSelectedDataMethod: 64,
  1197. dispidSetSelectedDataMethod: 65,
  1198. dispidAddBindingFromSelectionMethod: 66,
  1199. dispidAddBindingFromPromptMethod: 67,
  1200. dispidGetBindingMethod: 68,
  1201. dispidReleaseBindingMethod: 69,
  1202. dispidGetBindingDataMethod: 70,
  1203. dispidSetBindingDataMethod: 71,
  1204. dispidAddRowsMethod: 72,
  1205. dispidClearAllRowsMethod: 73,
  1206. dispidGetAllBindingsMethod: 74,
  1207. dispidLoadSettingsMethod: 75,
  1208. dispidSaveSettingsMethod: 76,
  1209. dispidGetDocumentCopyMethod: 77,
  1210. dispidAddBindingFromNamedItemMethod: 78,
  1211. dispidAddColumnsMethod: 79,
  1212. dispidGetDocumentCopyChunkMethod: 80,
  1213. dispidReleaseDocumentCopyMethod: 81,
  1214. dispidNavigateToMethod: 82,
  1215. dispidGetActiveViewMethod: 83,
  1216. dispidGetDocumentThemeMethod: 84,
  1217. dispidGetOfficeThemeMethod: 85,
  1218. dispidGetFilePropertiesMethod: 86,
  1219. dispidClearFormatsMethod: 87,
  1220. dispidSetTableOptionsMethod: 88,
  1221. dispidSetFormatsMethod: 89,
  1222. dispidExecuteRichApiRequestMethod: 93,
  1223. dispidAppCommandInvocationCompletedMethod: 94,
  1224. dispidCloseContainerMethod: 97,
  1225. dispidGetSelectedTaskMethod: 110,
  1226. dispidGetSelectedResourceMethod: 111,
  1227. dispidGetTaskMethod: 112,
  1228. dispidGetResourceFieldMethod: 113,
  1229. dispidGetWSSUrlMethod: 114,
  1230. dispidGetTaskFieldMethod: 115,
  1231. dispidGetProjectFieldMethod: 116,
  1232. dispidGetSelectedViewMethod: 117,
  1233. dispidGetTaskByIndexMethod: 118,
  1234. dispidGetResourceByIndexMethod: 119,
  1235. dispidSetTaskFieldMethod: 120,
  1236. dispidSetResourceFieldMethod: 121,
  1237. dispidGetMaxTaskIndexMethod: 122,
  1238. dispidGetMaxResourceIndexMethod: 123,
  1239. dispidCreateTaskMethod: 124,
  1240. dispidAddDataPartMethod: 128,
  1241. dispidGetDataPartByIdMethod: 129,
  1242. dispidGetDataPartsByNamespaceMethod: 130,
  1243. dispidGetDataPartXmlMethod: 131,
  1244. dispidGetDataPartNodesMethod: 132,
  1245. dispidDeleteDataPartMethod: 133,
  1246. dispidGetDataNodeValueMethod: 134,
  1247. dispidGetDataNodeXmlMethod: 135,
  1248. dispidGetDataNodesMethod: 136,
  1249. dispidSetDataNodeValueMethod: 137,
  1250. dispidSetDataNodeXmlMethod: 138,
  1251. dispidAddDataNamespaceMethod: 139,
  1252. dispidGetDataUriByPrefixMethod: 140,
  1253. dispidGetDataPrefixByUriMethod: 141,
  1254. dispidGetDataNodeTextMethod: 142,
  1255. dispidSetDataNodeTextMethod: 143,
  1256. dispidMessageParentMethod: 144,
  1257. dispidSendMessageMethod: 145,
  1258. dispidMethodMax: 145
  1259. };
  1260. OSF.DDA.EventDispId={
  1261. dispidEventMin: 0,
  1262. dispidInitializeEvent: 0,
  1263. dispidSettingsChangedEvent: 1,
  1264. dispidDocumentSelectionChangedEvent: 2,
  1265. dispidBindingSelectionChangedEvent: 3,
  1266. dispidBindingDataChangedEvent: 4,
  1267. dispidDocumentOpenEvent: 5,
  1268. dispidDocumentCloseEvent: 6,
  1269. dispidActiveViewChangedEvent: 7,
  1270. dispidDocumentThemeChangedEvent: 8,
  1271. dispidOfficeThemeChangedEvent: 9,
  1272. dispidDialogMessageReceivedEvent: 10,
  1273. dispidDialogNotificationShownInAddinEvent: 11,
  1274. dispidDialogParentMessageReceivedEvent: 12,
  1275. dispidActivationStatusChangedEvent: 32,
  1276. dispidAppCommandInvokedEvent: 39,
  1277. dispidOlkItemSelectedChangedEvent: 46,
  1278. dispidTaskSelectionChangedEvent: 56,
  1279. dispidResourceSelectionChangedEvent: 57,
  1280. dispidViewSelectionChangedEvent: 58,
  1281. dispidDataNodeAddedEvent: 60,
  1282. dispidDataNodeReplacedEvent: 61,
  1283. dispidDataNodeDeletedEvent: 62,
  1284. dispidEventMax: 63
  1285. };
  1286. OSF.DDA.ErrorCodeManager=(function () {
  1287. var _errorMappings={};
  1288. return {
  1289. getErrorArgs: function OSF_DDA_ErrorCodeManager$getErrorArgs(errorCode) {
  1290. var errorArgs=_errorMappings[errorCode];
  1291. if (!errorArgs) {
  1292. errorArgs=_errorMappings[this.errorCodes.ooeInternalError];
  1293. }
  1294. else {
  1295. if (!errorArgs.name) {
  1296. errorArgs.name=_errorMappings[this.errorCodes.ooeInternalError].name;
  1297. }
  1298. if (!errorArgs.message) {
  1299. errorArgs.message=_errorMappings[this.errorCodes.ooeInternalError].message;
  1300. }
  1301. }
  1302. return errorArgs;
  1303. },
  1304. addErrorMessage: function OSF_DDA_ErrorCodeManager$addErrorMessage(errorCode, errorNameMessage) {
  1305. _errorMappings[errorCode]=errorNameMessage;
  1306. },
  1307. errorCodes: {
  1308. ooeSuccess: 0,
  1309. ooeChunkResult: 1,
  1310. ooeCoercionTypeNotSupported: 1000,
  1311. ooeGetSelectionNotMatchDataType: 1001,
  1312. ooeCoercionTypeNotMatchBinding: 1002,
  1313. ooeInvalidGetRowColumnCounts: 1003,
  1314. ooeSelectionNotSupportCoercionType: 1004,
  1315. ooeInvalidGetStartRowColumn: 1005,
  1316. ooeNonUniformPartialGetNotSupported: 1006,
  1317. ooeGetDataIsTooLarge: 1008,
  1318. ooeFileTypeNotSupported: 1009,
  1319. ooeGetDataParametersConflict: 1010,
  1320. ooeInvalidGetColumns: 1011,
  1321. ooeInvalidGetRows: 1012,
  1322. ooeInvalidReadForBlankRow: 1013,
  1323. ooeUnsupportedDataObject: 2000,
  1324. ooeCannotWriteToSelection: 2001,
  1325. ooeDataNotMatchSelection: 2002,
  1326. ooeOverwriteWorksheetData: 2003,
  1327. ooeDataNotMatchBindingSize: 2004,
  1328. ooeInvalidSetStartRowColumn: 2005,
  1329. ooeInvalidDataFormat: 2006,
  1330. ooeDataNotMatchCoercionType: 2007,
  1331. ooeDataNotMatchBindingType: 2008,
  1332. ooeSetDataIsTooLarge: 2009,
  1333. ooeNonUniformPartialSetNotSupported: 2010,
  1334. ooeInvalidSetColumns: 2011,
  1335. ooeInvalidSetRows: 2012,
  1336. ooeSetDataParametersConflict: 2013,
  1337. ooeCellDataAmountBeyondLimits: 2014,
  1338. ooeSelectionCannotBound: 3000,
  1339. ooeBindingNotExist: 3002,
  1340. ooeBindingToMultipleSelection: 3003,
  1341. ooeInvalidSelectionForBindingType: 3004,
  1342. ooeOperationNotSupportedOnThisBindingType: 3005,
  1343. ooeNamedItemNotFound: 3006,
  1344. ooeMultipleNamedItemFound: 3007,
  1345. ooeInvalidNamedItemForBindingType: 3008,
  1346. ooeUnknownBindingType: 3009,
  1347. ooeOperationNotSupportedOnMatrixData: 3010,
  1348. ooeInvalidColumnsForBinding: 3011,
  1349. ooeSettingNameNotExist: 4000,
  1350. ooeSettingsCannotSave: 4001,
  1351. ooeSettingsAreStale: 4002,
  1352. ooeOperationNotSupported: 5000,
  1353. ooeInternalError: 5001,
  1354. ooeDocumentReadOnly: 5002,
  1355. ooeEventHandlerNotExist: 5003,
  1356. ooeInvalidApiCallInContext: 5004,
  1357. ooeShuttingDown: 5005,
  1358. ooeUnsupportedEnumeration: 5007,
  1359. ooeIndexOutOfRange: 5008,
  1360. ooeBrowserAPINotSupported: 5009,
  1361. ooeInvalidParam: 5010,
  1362. ooeRequestTimeout: 5011,
  1363. ooeTooManyIncompleteRequests: 5100,
  1364. ooeRequestTokenUnavailable: 5101,
  1365. ooeActivityLimitReached: 5102,
  1366. ooeCustomXmlNodeNotFound: 6000,
  1367. ooeCustomXmlError: 6100,
  1368. ooeCustomXmlExceedQuota: 6101,
  1369. ooeCustomXmlOutOfDate: 6102,
  1370. ooeNoCapability: 7000,
  1371. ooeCannotNavTo: 7001,
  1372. ooeSpecifiedIdNotExist: 7002,
  1373. ooeNavOutOfBound: 7004,
  1374. ooeElementMissing: 8000,
  1375. ooeProtectedError: 8001,
  1376. ooeInvalidCellsValue: 8010,
  1377. ooeInvalidTableOptionValue: 8011,
  1378. ooeInvalidFormatValue: 8012,
  1379. ooeRowIndexOutOfRange: 8020,
  1380. ooeColIndexOutOfRange: 8021,
  1381. ooeFormatValueOutOfRange: 8022,
  1382. ooeCellFormatAmountBeyondLimits: 8023,
  1383. ooeMemoryFileLimit: 11000,
  1384. ooeNetworkProblemRetrieveFile: 11001,
  1385. ooeInvalidSliceSize: 11002,
  1386. ooeInvalidCallback: 11101,
  1387. ooeInvalidWidth: 12000,
  1388. ooeInvalidHeight: 12001,
  1389. ooeNavigationError: 12002,
  1390. ooeInvalidScheme: 12003,
  1391. ooeAppDomains: 12004,
  1392. ooeRequireHTTPS: 12005,
  1393. ooeWebDialogClosed: 12006,
  1394. ooeDialogAlreadyOpened: 12007,
  1395. ooeEndUserAllow: 12008,
  1396. ooeEndUserIgnore: 12009,
  1397. ooeNotUILessDialog: 12010,
  1398. ooeCrossZone: 12011
  1399. },
  1400. initializeErrorMessages: function OSF_DDA_ErrorCodeManager$initializeErrorMessages(stringNS) {
  1401. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotSupported]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotSupported };
  1402. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetSelectionNotMatchDataType]={ name: stringNS.L_DataReadError, message: stringNS.L_GetSelectionNotSupported };
  1403. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotMatchBinding };
  1404. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRowColumnCounts]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRowColumnCounts };
  1405. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionNotSupportCoercionType]={ name: stringNS.L_DataReadError, message: stringNS.L_SelectionNotSupportCoercionType };
  1406. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetStartRowColumn]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetStartRowColumn };
  1407. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialGetNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_NonUniformPartialGetNotSupported };
  1408. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataIsTooLarge]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataIsTooLarge };
  1409. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFileTypeNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_FileTypeNotSupported };
  1410. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataParametersConflict]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataParametersConflict };
  1411. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetColumns]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetColumns };
  1412. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRows]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRows };
  1413. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidReadForBlankRow]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidReadForBlankRow };
  1414. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject]={ name: stringNS.L_DataWriteError, message: stringNS.L_UnsupportedDataObject };
  1415. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotWriteToSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_CannotWriteToSelection };
  1416. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchSelection };
  1417. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOverwriteWorksheetData]={ name: stringNS.L_DataWriteError, message: stringNS.L_OverwriteWorksheetData };
  1418. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingSize]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchBindingSize };
  1419. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetStartRowColumn]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetStartRowColumn };
  1420. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidDataFormat]={ name: stringNS.L_InvalidFormat, message: stringNS.L_InvalidDataFormat };
  1421. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchCoercionType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchCoercionType };
  1422. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchBindingType };
  1423. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataIsTooLarge]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataIsTooLarge };
  1424. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialSetNotSupported]={ name: stringNS.L_DataWriteError, message: stringNS.L_NonUniformPartialSetNotSupported };
  1425. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetColumns]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetColumns };
  1426. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetRows]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetRows };
  1427. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataParametersConflict]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataParametersConflict };
  1428. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionCannotBound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_SelectionCannotBound };
  1429. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingNotExist]={ name: stringNS.L_InvalidBindingError, message: stringNS.L_BindingNotExist };
  1430. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingToMultipleSelection]={ name: stringNS.L_BindingCreationError, message: stringNS.L_BindingToMultipleSelection };
  1431. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSelectionForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidSelectionForBindingType };
  1432. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnThisBindingType]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnThisBindingType };
  1433. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNamedItemNotFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_NamedItemNotFound };
  1434. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMultipleNamedItemFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_MultipleNamedItemFound };
  1435. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidNamedItemForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidNamedItemForBindingType };
  1436. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnknownBindingType]={ name: stringNS.L_InvalidBinding, message: stringNS.L_UnknownBindingType };
  1437. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnMatrixData]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnMatrixData };
  1438. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidColumnsForBinding]={ name: stringNS.L_InvalidBinding, message: stringNS.L_InvalidColumnsForBinding };
  1439. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingNameNotExist]={ name: stringNS.L_ReadSettingsError, message: stringNS.L_SettingNameNotExist };
  1440. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsCannotSave]={ name: stringNS.L_SaveSettingsError, message: stringNS.L_SettingsCannotSave };
  1441. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsAreStale]={ name: stringNS.L_SettingsStaleError, message: stringNS.L_SettingsAreStale };
  1442. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupported]={ name: stringNS.L_HostError, message: stringNS.L_OperationNotSupported };
  1443. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError]={ name: stringNS.L_InternalError, message: stringNS.L_InternalErrorDescription };
  1444. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDocumentReadOnly]={ name: stringNS.L_PermissionDenied, message: stringNS.L_DocumentReadOnly };
  1445. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist]={ name: stringNS.L_EventRegistrationError, message: stringNS.L_EventHandlerNotExist };
  1446. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext]={ name: stringNS.L_InvalidAPICall, message: stringNS.L_InvalidApiCallInContext };
  1447. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeShuttingDown]={ name: stringNS.L_ShuttingDown, message: stringNS.L_ShuttingDown };
  1448. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration]={ name: stringNS.L_UnsupportedEnumeration, message: stringNS.L_UnsupportedEnumerationMessage };
  1449. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1450. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBrowserAPINotSupported]={ name: stringNS.L_APINotSupported, message: stringNS.L_BrowserAPINotSupported };
  1451. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTimeout]={ name: stringNS.L_APICallFailed, message: stringNS.L_RequestTimeout };
  1452. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeTooManyIncompleteRequests]={ name: stringNS.L_APICallFailed, message: stringNS.L_TooManyIncompleteRequests };
  1453. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTokenUnavailable]={ name: stringNS.L_APICallFailed, message: stringNS.L_RequestTokenUnavailable };
  1454. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeActivityLimitReached]={ name: stringNS.L_APICallFailed, message: stringNS.L_ActivityLimitReached };
  1455. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlNodeNotFound]={ name: stringNS.L_InvalidNode, message: stringNS.L_CustomXmlNodeNotFound };
  1456. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlError]={ name: stringNS.L_CustomXmlError, message: stringNS.L_CustomXmlError };
  1457. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlExceedQuota]={ name: stringNS.L_CustomXmlExceedQuotaName, message: stringNS.L_CustomXmlExceedQuotaMessage };
  1458. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlOutOfDate]={ name: stringNS.L_CustomXmlOutOfDateName, message: stringNS.L_CustomXmlOutOfDateMessage };
  1459. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1460. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotNavTo]={ name: stringNS.L_CannotNavigateTo, message: stringNS.L_CannotNavigateTo };
  1461. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSpecifiedIdNotExist]={ name: stringNS.L_SpecifiedIdNotExist, message: stringNS.L_SpecifiedIdNotExist };
  1462. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavOutOfBound]={ name: stringNS.L_NavOutOfBound, message: stringNS.L_NavOutOfBound };
  1463. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellDataAmountBeyondLimits]={ name: stringNS.L_DataWriteReminder, message: stringNS.L_CellDataAmountBeyondLimits };
  1464. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeElementMissing]={ name: stringNS.L_MissingParameter, message: stringNS.L_ElementMissing };
  1465. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeProtectedError]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1466. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCellsValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidCellsValue };
  1467. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidTableOptionValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidTableOptionValue };
  1468. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidFormatValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidFormatValue };
  1469. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRowIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_RowIndexOutOfRange };
  1470. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeColIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_ColIndexOutOfRange };
  1471. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFormatValueOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_FormatValueOutOfRange };
  1472. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellFormatAmountBeyondLimits]={ name: stringNS.L_FormattingReminder, message: stringNS.L_CellFormatAmountBeyondLimits };
  1473. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMemoryFileLimit]={ name: stringNS.L_MemoryLimit, message: stringNS.L_CloseFileBeforeRetrieve };
  1474. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNetworkProblemRetrieveFile]={ name: stringNS.L_NetworkProblem, message: stringNS.L_NetworkProblemRetrieveFile };
  1475. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize]={ name: stringNS.L_InvalidValue, message: stringNS.L_SliceSizeNotSupported };
  1476. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDialogAlreadyOpened]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAlreadyOpened };
  1477. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidWidth]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1478. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidHeight]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1479. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavigationError]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_NetworkProblem };
  1480. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidScheme]={ name: stringNS.L_DialogNavigateError, message: stringNS.L_DialogAddressNotTrusted };
  1481. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeAppDomains]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAddressNotTrusted };
  1482. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequireHTTPS]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAddressNotTrusted };
  1483. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEndUserIgnore]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_UserClickIgnore };
  1484. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCrossZone]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_NewWindowCrossZoneErrorString };
  1485. }
  1486. };
  1487. })();
  1488. var OfficeExt;
  1489. (function (OfficeExt) {
  1490. var Requirement;
  1491. (function (Requirement) {
  1492. var RequirementMatrix=(function () {
  1493. function RequirementMatrix(_setMap) {
  1494. this.isSetSupported=function _isSetSupported(name, minVersion) {
  1495. if (name==undefined) {
  1496. return false;
  1497. }
  1498. if (minVersion==undefined) {
  1499. minVersion=0;
  1500. }
  1501. var setSupportArray=this._setMap;
  1502. var sets=setSupportArray._sets;
  1503. if (sets.hasOwnProperty(name.toLowerCase())) {
  1504. var setMaxVersion=sets[name.toLowerCase()];
  1505. return setMaxVersion > 0 && setMaxVersion >=minVersion;
  1506. }
  1507. else {
  1508. return false;
  1509. }
  1510. };
  1511. this._setMap=_setMap;
  1512. this.isSetSupported=this.isSetSupported.bind(this);
  1513. }
  1514. return RequirementMatrix;
  1515. })();
  1516. Requirement.RequirementMatrix=RequirementMatrix;
  1517. var DefaultSetRequirement=(function () {
  1518. function DefaultSetRequirement(setMap) {
  1519. this._addSetMap=function DefaultSetRequirement_addSetMap(addedSet) {
  1520. for (var name in addedSet) {
  1521. this._sets[name]=addedSet[name];
  1522. }
  1523. };
  1524. this._sets=setMap;
  1525. }
  1526. return DefaultSetRequirement;
  1527. })();
  1528. Requirement.DefaultSetRequirement=DefaultSetRequirement;
  1529. var DefaultDialogSetRequirement=(function (_super) {
  1530. __extends(DefaultDialogSetRequirement, _super);
  1531. function DefaultDialogSetRequirement() {
  1532. _super.call(this, {
  1533. "dialogapi": 1.1
  1534. });
  1535. }
  1536. return DefaultDialogSetRequirement;
  1537. })(DefaultSetRequirement);
  1538. Requirement.DefaultDialogSetRequirement=DefaultDialogSetRequirement;
  1539. var ExcelClientDefaultSetRequirement=(function (_super) {
  1540. __extends(ExcelClientDefaultSetRequirement, _super);
  1541. function ExcelClientDefaultSetRequirement() {
  1542. _super.call(this, {
  1543. "bindingevents": 1.1,
  1544. "documentevents": 1.1,
  1545. "excelapi": 1.1,
  1546. "matrixbindings": 1.1,
  1547. "matrixcoercion": 1.1,
  1548. "selection": 1.1,
  1549. "settings": 1.1,
  1550. "tablebindings": 1.1,
  1551. "tablecoercion": 1.1,
  1552. "textbindings": 1.1,
  1553. "textcoercion": 1.1
  1554. });
  1555. }
  1556. return ExcelClientDefaultSetRequirement;
  1557. })(DefaultSetRequirement);
  1558. Requirement.ExcelClientDefaultSetRequirement=ExcelClientDefaultSetRequirement;
  1559. var ExcelClientV1DefaultSetRequirement=(function (_super) {
  1560. __extends(ExcelClientV1DefaultSetRequirement, _super);
  1561. function ExcelClientV1DefaultSetRequirement() {
  1562. _super.call(this);
  1563. this._addSetMap({
  1564. "imagecoercion": 1.1
  1565. });
  1566. }
  1567. return ExcelClientV1DefaultSetRequirement;
  1568. })(ExcelClientDefaultSetRequirement);
  1569. Requirement.ExcelClientV1DefaultSetRequirement=ExcelClientV1DefaultSetRequirement;
  1570. var OutlookClientDefaultSetRequirement=(function (_super) {
  1571. __extends(OutlookClientDefaultSetRequirement, _super);
  1572. function OutlookClientDefaultSetRequirement() {
  1573. _super.call(this, {
  1574. "mailbox": 1.3
  1575. });
  1576. }
  1577. return OutlookClientDefaultSetRequirement;
  1578. })(DefaultSetRequirement);
  1579. Requirement.OutlookClientDefaultSetRequirement=OutlookClientDefaultSetRequirement;
  1580. var WordClientDefaultSetRequirement=(function (_super) {
  1581. __extends(WordClientDefaultSetRequirement, _super);
  1582. function WordClientDefaultSetRequirement() {
  1583. _super.call(this, {
  1584. "bindingevents": 1.1,
  1585. "compressedfile": 1.1,
  1586. "customxmlparts": 1.1,
  1587. "documentevents": 1.1,
  1588. "file": 1.1,
  1589. "htmlcoercion": 1.1,
  1590. "matrixbindings": 1.1,
  1591. "matrixcoercion": 1.1,
  1592. "ooxmlcoercion": 1.1,
  1593. "pdffile": 1.1,
  1594. "selection": 1.1,
  1595. "settings": 1.1,
  1596. "tablebindings": 1.1,
  1597. "tablecoercion": 1.1,
  1598. "textbindings": 1.1,
  1599. "textcoercion": 1.1,
  1600. "textfile": 1.1,
  1601. "wordapi": 1.1
  1602. });
  1603. }
  1604. return WordClientDefaultSetRequirement;
  1605. })(DefaultSetRequirement);
  1606. Requirement.WordClientDefaultSetRequirement=WordClientDefaultSetRequirement;
  1607. var WordClientV1DefaultSetRequirement=(function (_super) {
  1608. __extends(WordClientV1DefaultSetRequirement, _super);
  1609. function WordClientV1DefaultSetRequirement() {
  1610. _super.call(this);
  1611. this._addSetMap({
  1612. "customxmlparts": 1.2,
  1613. "wordapi": 1.2,
  1614. "imagecoercion": 1.1
  1615. });
  1616. }
  1617. return WordClientV1DefaultSetRequirement;
  1618. })(WordClientDefaultSetRequirement);
  1619. Requirement.WordClientV1DefaultSetRequirement=WordClientV1DefaultSetRequirement;
  1620. var PowerpointClientDefaultSetRequirement=(function (_super) {
  1621. __extends(PowerpointClientDefaultSetRequirement, _super);
  1622. function PowerpointClientDefaultSetRequirement() {
  1623. _super.call(this, {
  1624. "activeview": 1.1,
  1625. "compressedfile": 1.1,
  1626. "documentevents": 1.1,
  1627. "file": 1.1,
  1628. "pdffile": 1.1,
  1629. "selection": 1.1,
  1630. "settings": 1.1,
  1631. "textcoercion": 1.1
  1632. });
  1633. }
  1634. return PowerpointClientDefaultSetRequirement;
  1635. })(DefaultSetRequirement);
  1636. Requirement.PowerpointClientDefaultSetRequirement=PowerpointClientDefaultSetRequirement;
  1637. var PowerpointClientV1DefaultSetRequirement=(function (_super) {
  1638. __extends(PowerpointClientV1DefaultSetRequirement, _super);
  1639. function PowerpointClientV1DefaultSetRequirement() {
  1640. _super.call(this);
  1641. this._addSetMap({
  1642. "imagecoercion": 1.1
  1643. });
  1644. }
  1645. return PowerpointClientV1DefaultSetRequirement;
  1646. })(PowerpointClientDefaultSetRequirement);
  1647. Requirement.PowerpointClientV1DefaultSetRequirement=PowerpointClientV1DefaultSetRequirement;
  1648. var ProjectClientDefaultSetRequirement=(function (_super) {
  1649. __extends(ProjectClientDefaultSetRequirement, _super);
  1650. function ProjectClientDefaultSetRequirement() {
  1651. _super.call(this, {
  1652. "selection": 1.1,
  1653. "textcoercion": 1.1
  1654. });
  1655. }
  1656. return ProjectClientDefaultSetRequirement;
  1657. })(DefaultSetRequirement);
  1658. Requirement.ProjectClientDefaultSetRequirement=ProjectClientDefaultSetRequirement;
  1659. var ExcelWebDefaultSetRequirement=(function (_super) {
  1660. __extends(ExcelWebDefaultSetRequirement, _super);
  1661. function ExcelWebDefaultSetRequirement() {
  1662. _super.call(this, {
  1663. "bindingevents": 1.1,
  1664. "documentevents": 1.1,
  1665. "matrixbindings": 1.1,
  1666. "matrixcoercion": 1.1,
  1667. "selection": 1.1,
  1668. "settings": 1.1,
  1669. "tablebindings": 1.1,
  1670. "tablecoercion": 1.1,
  1671. "textbindings": 1.1,
  1672. "textcoercion": 1.1,
  1673. "file": 1.1
  1674. });
  1675. }
  1676. return ExcelWebDefaultSetRequirement;
  1677. })(DefaultSetRequirement);
  1678. Requirement.ExcelWebDefaultSetRequirement=ExcelWebDefaultSetRequirement;
  1679. var WordWebDefaultSetRequirement=(function (_super) {
  1680. __extends(WordWebDefaultSetRequirement, _super);
  1681. function WordWebDefaultSetRequirement() {
  1682. _super.call(this, {
  1683. "compressedfile": 1.1,
  1684. "documentevents": 1.1,
  1685. "file": 1.1,
  1686. "imagecoercion": 1.1,
  1687. "matrixcoercion": 1.1,
  1688. "ooxmlcoercion": 1.1,
  1689. "pdffile": 1.1,
  1690. "selection": 1.1,
  1691. "settings": 1.1,
  1692. "tablecoercion": 1.1,
  1693. "textcoercion": 1.1,
  1694. "textfile": 1.1
  1695. });
  1696. }
  1697. return WordWebDefaultSetRequirement;
  1698. })(DefaultSetRequirement);
  1699. Requirement.WordWebDefaultSetRequirement=WordWebDefaultSetRequirement;
  1700. var PowerpointWebDefaultSetRequirement=(function (_super) {
  1701. __extends(PowerpointWebDefaultSetRequirement, _super);
  1702. function PowerpointWebDefaultSetRequirement() {
  1703. _super.call(this, {
  1704. "activeview": 1.1,
  1705. "settings": 1.1
  1706. });
  1707. }
  1708. return PowerpointWebDefaultSetRequirement;
  1709. })(DefaultSetRequirement);
  1710. Requirement.PowerpointWebDefaultSetRequirement=PowerpointWebDefaultSetRequirement;
  1711. var OutlookWebDefaultSetRequirement=(function (_super) {
  1712. __extends(OutlookWebDefaultSetRequirement, _super);
  1713. function OutlookWebDefaultSetRequirement() {
  1714. _super.call(this, {
  1715. "mailbox": 1.3
  1716. });
  1717. }
  1718. return OutlookWebDefaultSetRequirement;
  1719. })(DefaultSetRequirement);
  1720. Requirement.OutlookWebDefaultSetRequirement=OutlookWebDefaultSetRequirement;
  1721. var SwayWebDefaultSetRequirement=(function (_super) {
  1722. __extends(SwayWebDefaultSetRequirement, _super);
  1723. function SwayWebDefaultSetRequirement() {
  1724. _super.call(this, {
  1725. "activeview": 1.1,
  1726. "documentevents": 1.1,
  1727. "selection": 1.1,
  1728. "settings": 1.1,
  1729. "textcoercion": 1.1
  1730. });
  1731. }
  1732. return SwayWebDefaultSetRequirement;
  1733. })(DefaultSetRequirement);
  1734. Requirement.SwayWebDefaultSetRequirement=SwayWebDefaultSetRequirement;
  1735. var AccessWebDefaultSetRequirement=(function (_super) {
  1736. __extends(AccessWebDefaultSetRequirement, _super);
  1737. function AccessWebDefaultSetRequirement() {
  1738. _super.call(this, {
  1739. "bindingevents": 1.1,
  1740. "partialtablebindings": 1.1,
  1741. "settings": 1.1,
  1742. "tablebindings": 1.1,
  1743. "tablecoercion": 1.1
  1744. });
  1745. }
  1746. return AccessWebDefaultSetRequirement;
  1747. })(DefaultSetRequirement);
  1748. Requirement.AccessWebDefaultSetRequirement=AccessWebDefaultSetRequirement;
  1749. var ExcelIOSDefaultSetRequirement=(function (_super) {
  1750. __extends(ExcelIOSDefaultSetRequirement, _super);
  1751. function ExcelIOSDefaultSetRequirement() {
  1752. _super.call(this, {
  1753. "bindingevents": 1.1,
  1754. "documentevents": 1.1,
  1755. "matrixbindings": 1.1,
  1756. "matrixcoercion": 1.1,
  1757. "selection": 1.1,
  1758. "settings": 1.1,
  1759. "tablebindings": 1.1,
  1760. "tablecoercion": 1.1,
  1761. "textbindings": 1.1,
  1762. "textcoercion": 1.1
  1763. });
  1764. }
  1765. return ExcelIOSDefaultSetRequirement;
  1766. })(DefaultSetRequirement);
  1767. Requirement.ExcelIOSDefaultSetRequirement=ExcelIOSDefaultSetRequirement;
  1768. var WordIOSDefaultSetRequirement=(function (_super) {
  1769. __extends(WordIOSDefaultSetRequirement, _super);
  1770. function WordIOSDefaultSetRequirement() {
  1771. _super.call(this, {
  1772. "bindingevents": 1.1,
  1773. "compressedfile": 1.1,
  1774. "customxmlparts": 1.1,
  1775. "documentevents": 1.1,
  1776. "file": 1.1,
  1777. "htmlcoercion": 1.1,
  1778. "matrixbindings": 1.1,
  1779. "matrixcoercion": 1.1,
  1780. "ooxmlcoercion": 1.1,
  1781. "pdffile": 1.1,
  1782. "selection": 1.1,
  1783. "settings": 1.1,
  1784. "tablebindings": 1.1,
  1785. "tablecoercion": 1.1,
  1786. "textbindings": 1.1,
  1787. "textcoercion": 1.1,
  1788. "textfile": 1.1
  1789. });
  1790. }
  1791. return WordIOSDefaultSetRequirement;
  1792. })(DefaultSetRequirement);
  1793. Requirement.WordIOSDefaultSetRequirement=WordIOSDefaultSetRequirement;
  1794. var WordIOSV1DefaultSetRequirement=(function (_super) {
  1795. __extends(WordIOSV1DefaultSetRequirement, _super);
  1796. function WordIOSV1DefaultSetRequirement() {
  1797. _super.call(this);
  1798. this._addSetMap({
  1799. "customxmlparts": 1.2,
  1800. "wordapi": 1.2
  1801. });
  1802. }
  1803. return WordIOSV1DefaultSetRequirement;
  1804. })(WordIOSDefaultSetRequirement);
  1805. Requirement.WordIOSV1DefaultSetRequirement=WordIOSV1DefaultSetRequirement;
  1806. var PowerpointIOSDefaultSetRequirement=(function (_super) {
  1807. __extends(PowerpointIOSDefaultSetRequirement, _super);
  1808. function PowerpointIOSDefaultSetRequirement() {
  1809. _super.call(this, {
  1810. "activeview": 1.1,
  1811. "compressedfile": 1.1,
  1812. "documentevents": 1.1,
  1813. "file": 1.1,
  1814. "pdffile": 1.1,
  1815. "selection": 1.1,
  1816. "settings": 1.1,
  1817. "textcoercion": 1.1
  1818. });
  1819. }
  1820. return PowerpointIOSDefaultSetRequirement;
  1821. })(DefaultSetRequirement);
  1822. Requirement.PowerpointIOSDefaultSetRequirement=PowerpointIOSDefaultSetRequirement;
  1823. var OutlookIOSDefaultSetRequirement=(function (_super) {
  1824. __extends(OutlookIOSDefaultSetRequirement, _super);
  1825. function OutlookIOSDefaultSetRequirement() {
  1826. _super.call(this, {
  1827. "mailbox": 1.1
  1828. });
  1829. }
  1830. return OutlookIOSDefaultSetRequirement;
  1831. })(DefaultSetRequirement);
  1832. Requirement.OutlookIOSDefaultSetRequirement=OutlookIOSDefaultSetRequirement;
  1833. var RequirementsMatrixFactory=(function () {
  1834. function RequirementsMatrixFactory() {
  1835. }
  1836. RequirementsMatrixFactory.initializeOsfDda=function () {
  1837. OSF.OUtil.setNamespace("Requirement", OSF.DDA);
  1838. };
  1839. RequirementsMatrixFactory.getDefaultRequirementMatrix=function (appContext) {
  1840. this.initializeDefaultSetMatrix();
  1841. var defaultRequirementMatrix=undefined;
  1842. var clientRequirement=appContext.get_requirementMatrix();
  1843. if (clientRequirement !=undefined && clientRequirement.length > 0 && typeof (JSON) !=="undefined") {
  1844. var matrixItem=JSON.parse(appContext.get_requirementMatrix().toLowerCase());
  1845. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement(matrixItem));
  1846. }
  1847. else {
  1848. var appLocator=RequirementsMatrixFactory.getClientFullVersionString(appContext);
  1849. if (RequirementsMatrixFactory.DefaultSetArrayMatrix !=undefined && RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator] !=undefined) {
  1850. defaultRequirementMatrix=new RequirementMatrix(RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator]);
  1851. }
  1852. else {
  1853. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement({}));
  1854. }
  1855. }
  1856. return defaultRequirementMatrix;
  1857. };
  1858. RequirementsMatrixFactory.getDefaultDialogRequirementMatrix=function (appContext) {
  1859. var defaultRequirementMatrix=undefined;
  1860. var clientRequirement=appContext.get_dialogRequirementMatrix();
  1861. if (clientRequirement !=undefined && clientRequirement.length > 0 && typeof (JSON) !=="undefined") {
  1862. var matrixItem=JSON.parse(appContext.get_requirementMatrix().toLowerCase());
  1863. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement(matrixItem));
  1864. }
  1865. else {
  1866. defaultRequirementMatrix=new RequirementMatrix(new DefaultDialogSetRequirement());
  1867. }
  1868. return defaultRequirementMatrix;
  1869. };
  1870. RequirementsMatrixFactory.getClientFullVersionString=function (appContext) {
  1871. var appMinorVersion=appContext.get_appMinorVersion();
  1872. var appMinorVersionString="";
  1873. var appFullVersion="";
  1874. var appName=appContext.get_appName();
  1875. var isIOSClient=appName==1024 ||
  1876. appName==4096 ||
  1877. appName==8192 ||
  1878. appName==65536;
  1879. if (isIOSClient && appContext.get_appVersion()==1) {
  1880. if (appName==4096 && appMinorVersion >=15) {
  1881. appFullVersion="16.00.01";
  1882. }
  1883. else {
  1884. appFullVersion="16.00";
  1885. }
  1886. }
  1887. else if (appContext.get_appName()==64) {
  1888. appFullVersion=appContext.get_appVersion();
  1889. }
  1890. else {
  1891. if (appMinorVersion < 10) {
  1892. appMinorVersionString="0"+appMinorVersion;
  1893. }
  1894. else {
  1895. appMinorVersionString=""+appMinorVersion;
  1896. }
  1897. appFullVersion=appContext.get_appVersion()+"."+appMinorVersionString;
  1898. }
  1899. return appContext.get_appName()+"-"+appFullVersion;
  1900. };
  1901. RequirementsMatrixFactory.initializeDefaultSetMatrix=function () {
  1902. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1600]=new ExcelClientDefaultSetRequirement();
  1903. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1600]=new WordClientDefaultSetRequirement();
  1904. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1600]=new PowerpointClientDefaultSetRequirement();
  1905. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1601]=new ExcelClientV1DefaultSetRequirement();
  1906. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1601]=new WordClientV1DefaultSetRequirement();
  1907. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1601]=new PowerpointClientV1DefaultSetRequirement();
  1908. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_RCLIENT_1600]=new OutlookClientDefaultSetRequirement();
  1909. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_WAC_1600]=new ExcelWebDefaultSetRequirement();
  1910. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_WAC_1600]=new WordWebDefaultSetRequirement();
  1911. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1600]=new OutlookWebDefaultSetRequirement();
  1912. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1601]=new OutlookWebDefaultSetRequirement();
  1913. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Project_RCLIENT_1600]=new ProjectClientDefaultSetRequirement();
  1914. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Access_WAC_1600]=new AccessWebDefaultSetRequirement();
  1915. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_WAC_1600]=new PowerpointWebDefaultSetRequirement();
  1916. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_IOS_1600]=new ExcelIOSDefaultSetRequirement();
  1917. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.SWAY_WAC_1600]=new SwayWebDefaultSetRequirement();
  1918. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_1600]=new WordIOSDefaultSetRequirement();
  1919. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_16001]=new WordIOSV1DefaultSetRequirement();
  1920. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_IOS_1600]=new PowerpointIOSDefaultSetRequirement();
  1921. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_IOS_1600]=new OutlookIOSDefaultSetRequirement();
  1922. };
  1923. RequirementsMatrixFactory.Excel_RCLIENT_1600="1-16.00";
  1924. RequirementsMatrixFactory.Excel_RCLIENT_1601="1-16.01";
  1925. RequirementsMatrixFactory.Word_RCLIENT_1600="2-16.00";
  1926. RequirementsMatrixFactory.Word_RCLIENT_1601="2-16.01";
  1927. RequirementsMatrixFactory.PowerPoint_RCLIENT_1600="4-16.00";
  1928. RequirementsMatrixFactory.PowerPoint_RCLIENT_1601="4-16.01";
  1929. RequirementsMatrixFactory.Outlook_RCLIENT_1600="8-16.00";
  1930. RequirementsMatrixFactory.Excel_WAC_1600="16-16.00";
  1931. RequirementsMatrixFactory.Word_WAC_1600="32-16.00";
  1932. RequirementsMatrixFactory.Outlook_WAC_1600="64-16.00";
  1933. RequirementsMatrixFactory.Outlook_WAC_1601="64-16.01";
  1934. RequirementsMatrixFactory.Project_RCLIENT_1600="128-16.00";
  1935. RequirementsMatrixFactory.Access_WAC_1600="256-16.00";
  1936. RequirementsMatrixFactory.PowerPoint_WAC_1600="512-16.00";
  1937. RequirementsMatrixFactory.Excel_IOS_1600="1024-16.00";
  1938. RequirementsMatrixFactory.SWAY_WAC_1600="2048-16.00";
  1939. RequirementsMatrixFactory.Word_IOS_1600="4096-16.00";
  1940. RequirementsMatrixFactory.Word_IOS_16001="4096-16.00.01";
  1941. RequirementsMatrixFactory.PowerPoint_IOS_1600="8192-16.00";
  1942. RequirementsMatrixFactory.Outlook_IOS_1600="65536-16.00";
  1943. RequirementsMatrixFactory.DefaultSetArrayMatrix={};
  1944. return RequirementsMatrixFactory;
  1945. })();
  1946. Requirement.RequirementsMatrixFactory=RequirementsMatrixFactory;
  1947. })(Requirement=OfficeExt.Requirement || (OfficeExt.Requirement={}));
  1948. })(OfficeExt || (OfficeExt={}));
  1949. OfficeExt.Requirement.RequirementsMatrixFactory.initializeOsfDda();
  1950. Microsoft.Office.WebExtension.ApplicationMode={
  1951. WebEditor: "webEditor",
  1952. WebViewer: "webViewer",
  1953. Client: "client"
  1954. };
  1955. Microsoft.Office.WebExtension.DocumentMode={
  1956. ReadOnly: "readOnly",
  1957. ReadWrite: "readWrite"
  1958. };
  1959. OSF.NamespaceManager=(function OSF_NamespaceManager() {
  1960. var _userOffice;
  1961. var _useShortcut=false;
  1962. return {
  1963. enableShortcut: function OSF_NamespaceManager$enableShortcut() {
  1964. if (!_useShortcut) {
  1965. if (window.Office) {
  1966. _userOffice=window.Office;
  1967. }
  1968. else {
  1969. OSF.OUtil.setNamespace("Office", window);
  1970. }
  1971. window.Office=Microsoft.Office.WebExtension;
  1972. _useShortcut=true;
  1973. }
  1974. },
  1975. disableShortcut: function OSF_NamespaceManager$disableShortcut() {
  1976. if (_useShortcut) {
  1977. if (_userOffice) {
  1978. window.Office=_userOffice;
  1979. }
  1980. else {
  1981. OSF.OUtil.unsetNamespace("Office", window);
  1982. }
  1983. _useShortcut=false;
  1984. }
  1985. }
  1986. };
  1987. })();
  1988. OSF.NamespaceManager.enableShortcut();
  1989. Microsoft.Office.WebExtension.useShortNamespace=function Microsoft_Office_WebExtension_useShortNamespace(useShortcut) {
  1990. if (useShortcut) {
  1991. OSF.NamespaceManager.enableShortcut();
  1992. }
  1993. else {
  1994. OSF.NamespaceManager.disableShortcut();
  1995. }
  1996. };
  1997. Microsoft.Office.WebExtension.select=function Microsoft_Office_WebExtension_select(str, errorCallback) {
  1998. var promise;
  1999. if (str && typeof str=="string") {
  2000. var index=str.indexOf("#");
  2001. if (index !=-1) {
  2002. var op=str.substring(0, index);
  2003. var target=str.substring(index+1);
  2004. switch (op) {
  2005. case "binding":
  2006. case "bindings":
  2007. if (target) {
  2008. promise=new OSF.DDA.BindingPromise(target);
  2009. }
  2010. break;
  2011. }
  2012. }
  2013. }
  2014. if (!promise) {
  2015. if (errorCallback) {
  2016. var callbackType=typeof errorCallback;
  2017. if (callbackType=="function") {
  2018. var callArgs={};
  2019. callArgs[Microsoft.Office.WebExtension.Parameters.Callback]=errorCallback;
  2020. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext, OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext));
  2021. }
  2022. else {
  2023. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, callbackType);
  2024. }
  2025. }
  2026. }
  2027. else {
  2028. promise.onFail=errorCallback;
  2029. return promise;
  2030. }
  2031. };
  2032. OSF.DDA.Context=function OSF_DDA_Context(officeAppContext, document, license, appOM, getOfficeTheme) {
  2033. OSF.OUtil.defineEnumerableProperties(this, {
  2034. "contentLanguage": {
  2035. value: officeAppContext.get_dataLocale()
  2036. },
  2037. "displayLanguage": {
  2038. value: officeAppContext.get_appUILocale()
  2039. },
  2040. "touchEnabled": {
  2041. value: officeAppContext.get_touchEnabled()
  2042. },
  2043. "commerceAllowed": {
  2044. value: officeAppContext.get_commerceAllowed()
  2045. }
  2046. });
  2047. if (license) {
  2048. OSF.OUtil.defineEnumerableProperty(this, "license", {
  2049. value: license
  2050. });
  2051. }
  2052. if (officeAppContext.ui) {
  2053. OSF.OUtil.defineEnumerableProperty(this, "ui", {
  2054. value: officeAppContext.ui
  2055. });
  2056. }
  2057. if (officeAppContext.get_isDialog()) {
  2058. var requirements=OfficeExt.Requirement.RequirementsMatrixFactory.getDefaultDialogRequirementMatrix(officeAppContext);
  2059. OSF.OUtil.defineEnumerableProperty(this, "requirements", {
  2060. value: requirements
  2061. });
  2062. }
  2063. else {
  2064. if (document) {
  2065. OSF.OUtil.defineEnumerableProperty(this, "document", {
  2066. value: document
  2067. });
  2068. }
  2069. if (appOM) {
  2070. var displayName=appOM.displayName || "appOM";
  2071. delete appOM.displayName;
  2072. OSF.OUtil.defineEnumerableProperty(this, displayName, {
  2073. value: appOM
  2074. });
  2075. }
  2076. if (getOfficeTheme) {
  2077. OSF.OUtil.defineEnumerableProperty(this, "officeTheme", {
  2078. get: function () {
  2079. return getOfficeTheme();
  2080. }
  2081. });
  2082. }
  2083. var requirements=OfficeExt.Requirement.RequirementsMatrixFactory.getDefaultRequirementMatrix(officeAppContext);
  2084. OSF.OUtil.defineEnumerableProperty(this, "requirements", {
  2085. value: requirements
  2086. });
  2087. }
  2088. };
  2089. OSF.DDA.OutlookContext=function OSF_DDA_OutlookContext(appContext, settings, license, appOM, getOfficeTheme) {
  2090. OSF.DDA.OutlookContext.uber.constructor.call(this, appContext, null, license, appOM, getOfficeTheme);
  2091. if (settings) {
  2092. OSF.OUtil.defineEnumerableProperty(this, "roamingSettings", {
  2093. value: settings
  2094. });
  2095. }
  2096. };
  2097. OSF.OUtil.extend(OSF.DDA.OutlookContext, OSF.DDA.Context);
  2098. OSF.DDA.OutlookAppOm=function OSF_DDA_OutlookAppOm(appContext, window, appReady) { };
  2099. OSF.DDA.Document=function OSF_DDA_Document(officeAppContext, settings) {
  2100. var mode;
  2101. switch (officeAppContext.get_clientMode()) {
  2102. case OSF.ClientMode.ReadOnly:
  2103. mode=Microsoft.Office.WebExtension.DocumentMode.ReadOnly;
  2104. break;
  2105. case OSF.ClientMode.ReadWrite:
  2106. mode=Microsoft.Office.WebExtension.DocumentMode.ReadWrite;
  2107. break;
  2108. }
  2109. ;
  2110. if (settings) {
  2111. OSF.OUtil.defineEnumerableProperty(this, "settings", {
  2112. value: settings
  2113. });
  2114. }
  2115. ;
  2116. OSF.OUtil.defineMutableProperties(this, {
  2117. "mode": {
  2118. value: mode
  2119. },
  2120. "url": {
  2121. value: officeAppContext.get_docUrl()
  2122. }
  2123. });
  2124. };
  2125. OSF.DDA.JsomDocument=function OSF_DDA_JsomDocument(officeAppContext, bindingFacade, settings) {
  2126. OSF.DDA.JsomDocument.uber.constructor.call(this, officeAppContext, settings);
  2127. if (bindingFacade) {
  2128. OSF.OUtil.defineEnumerableProperty(this, "bindings", {
  2129. get: function OSF_DDA_Document$GetBindings() { return bindingFacade; }
  2130. });
  2131. }
  2132. var am=OSF.DDA.AsyncMethodNames;
  2133. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  2134. am.GetSelectedDataAsync,
  2135. am.SetSelectedDataAsync
  2136. ]);
  2137. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged]));
  2138. };
  2139. OSF.OUtil.extend(OSF.DDA.JsomDocument, OSF.DDA.Document);
  2140. OSF.OUtil.defineEnumerableProperty(Microsoft.Office.WebExtension, "context", {
  2141. get: function Microsoft_Office_WebExtension$GetContext() {
  2142. var context;
  2143. if (OSF && OSF._OfficeAppFactory) {
  2144. context=OSF._OfficeAppFactory.getContext();
  2145. }
  2146. return context;
  2147. }
  2148. });
  2149. OSF.DDA.License=function OSF_DDA_License(eToken) {
  2150. OSF.OUtil.defineEnumerableProperty(this, "value", {
  2151. value: eToken
  2152. });
  2153. };
  2154. OSF.DDA.ApiMethodCall=function OSF_DDA_ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2155. var requiredCount=requiredParameters.length;
  2156. var getInvalidParameterString=OSF.OUtil.delayExecutionAndCache(function () {
  2157. return OSF.OUtil.formatString(Strings.OfficeOM.L_InvalidParameters, displayName);
  2158. });
  2159. this.verifyArguments=function OSF_DDA_ApiMethodCall$VerifyArguments(params, args) {
  2160. for (var name in params) {
  2161. var param=params[name];
  2162. var arg=args[name];
  2163. if (param["enum"]) {
  2164. switch (typeof arg) {
  2165. case "string":
  2166. if (OSF.OUtil.listContainsValue(param["enum"], arg)) {
  2167. break;
  2168. }
  2169. case "undefined":
  2170. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration;
  2171. default:
  2172. throw getInvalidParameterString();
  2173. }
  2174. }
  2175. if (param["types"]) {
  2176. if (!OSF.OUtil.listContainsValue(param["types"], typeof arg)) {
  2177. throw getInvalidParameterString();
  2178. }
  2179. }
  2180. }
  2181. };
  2182. this.extractRequiredArguments=function OSF_DDA_ApiMethodCall$ExtractRequiredArguments(userArgs, caller, stateInfo) {
  2183. if (userArgs.length < requiredCount) {
  2184. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_MissingRequiredArguments);
  2185. }
  2186. var requiredArgs=[];
  2187. var index;
  2188. for (index=0; index < requiredCount; index++) {
  2189. requiredArgs.push(userArgs[index]);
  2190. }
  2191. this.verifyArguments(requiredParameters, requiredArgs);
  2192. var ret={};
  2193. for (index=0; index < requiredCount; index++) {
  2194. var param=requiredParameters[index];
  2195. var arg=requiredArgs[index];
  2196. if (param.verify) {
  2197. var isValid=param.verify(arg, caller, stateInfo);
  2198. if (!isValid) {
  2199. throw getInvalidParameterString();
  2200. }
  2201. }
  2202. ret[param.name]=arg;
  2203. }
  2204. return ret;
  2205. },
  2206. this.fillOptions=function OSF_DDA_ApiMethodCall$FillOptions(options, requiredArgs, caller, stateInfo) {
  2207. options=options || {};
  2208. for (var optionName in supportedOptions) {
  2209. if (!OSF.OUtil.listContainsKey(options, optionName)) {
  2210. var value=undefined;
  2211. var option=supportedOptions[optionName];
  2212. if (option.calculate && requiredArgs) {
  2213. value=option.calculate(requiredArgs, caller, stateInfo);
  2214. }
  2215. if (!value && option.defaultValue !==undefined) {
  2216. value=option.defaultValue;
  2217. }
  2218. options[optionName]=value;
  2219. }
  2220. }
  2221. return options;
  2222. };
  2223. this.constructCallArgs=function OSF_DAA_ApiMethodCall$ConstructCallArgs(required, options, caller, stateInfo) {
  2224. var callArgs={};
  2225. for (var r in required) {
  2226. callArgs[r]=required[r];
  2227. }
  2228. for (var o in options) {
  2229. callArgs[o]=options[o];
  2230. }
  2231. for (var s in privateStateCallbacks) {
  2232. callArgs[s]=privateStateCallbacks[s](caller, stateInfo);
  2233. }
  2234. if (checkCallArgs) {
  2235. callArgs=checkCallArgs(callArgs, caller, stateInfo);
  2236. }
  2237. return callArgs;
  2238. };
  2239. };
  2240. OSF.OUtil.setNamespace("AsyncResultEnum", OSF.DDA);
  2241. OSF.DDA.AsyncResultEnum.Properties={
  2242. Context: "Context",
  2243. Value: "Value",
  2244. Status: "Status",
  2245. Error: "Error"
  2246. };
  2247. Microsoft.Office.WebExtension.AsyncResultStatus={
  2248. Succeeded: "succeeded",
  2249. Failed: "failed"
  2250. };
  2251. OSF.DDA.AsyncResultEnum.ErrorCode={
  2252. Success: 0,
  2253. Failed: 1
  2254. };
  2255. OSF.DDA.AsyncResultEnum.ErrorProperties={
  2256. Name: "Name",
  2257. Message: "Message",
  2258. Code: "Code"
  2259. };
  2260. OSF.DDA.AsyncMethodNames={};
  2261. OSF.DDA.AsyncMethodNames.addNames=function (methodNames) {
  2262. for (var entry in methodNames) {
  2263. var am={};
  2264. OSF.OUtil.defineEnumerableProperties(am, {
  2265. "id": {
  2266. value: entry
  2267. },
  2268. "displayName": {
  2269. value: methodNames[entry]
  2270. }
  2271. });
  2272. OSF.DDA.AsyncMethodNames[entry]=am;
  2273. }
  2274. };
  2275. OSF.DDA.AsyncMethodCall=function OSF_DDA_AsyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, onSucceeded, onFailed, checkCallArgs, displayName) {
  2276. var requiredCount=requiredParameters.length;
  2277. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2278. function OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2279. if (userArgs.length > requiredCount+2) {
  2280. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2281. }
  2282. var options, parameterCallback;
  2283. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2284. var argument=userArgs[i];
  2285. switch (typeof argument) {
  2286. case "object":
  2287. if (options) {
  2288. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2289. }
  2290. else {
  2291. options=argument;
  2292. }
  2293. break;
  2294. case "function":
  2295. if (parameterCallback) {
  2296. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalFunction);
  2297. }
  2298. else {
  2299. parameterCallback=argument;
  2300. }
  2301. break;
  2302. default:
  2303. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2304. break;
  2305. }
  2306. }
  2307. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2308. if (parameterCallback) {
  2309. if (options[Microsoft.Office.WebExtension.Parameters.Callback]) {
  2310. throw Strings.OfficeOM.L_RedundantCallbackSpecification;
  2311. }
  2312. else {
  2313. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2314. }
  2315. }
  2316. apiMethods.verifyArguments(supportedOptions, options);
  2317. return options;
  2318. }
  2319. ;
  2320. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2321. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2322. var options=OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2323. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2324. return callArgs;
  2325. };
  2326. this.processResponse=function OSF_DAA_AsyncMethodCall$ProcessResponse(status, response, caller, callArgs) {
  2327. var payload;
  2328. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2329. if (onSucceeded) {
  2330. payload=onSucceeded(response, caller, callArgs);
  2331. }
  2332. else {
  2333. payload=response;
  2334. }
  2335. }
  2336. else {
  2337. if (onFailed) {
  2338. payload=onFailed(status, response);
  2339. }
  2340. else {
  2341. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2342. }
  2343. }
  2344. return payload;
  2345. };
  2346. this.getCallArgs=function (suppliedArgs) {
  2347. var options, parameterCallback;
  2348. for (var i=suppliedArgs.length - 1; i >=requiredCount; i--) {
  2349. var argument=suppliedArgs[i];
  2350. switch (typeof argument) {
  2351. case "object":
  2352. options=argument;
  2353. break;
  2354. case "function":
  2355. parameterCallback=argument;
  2356. break;
  2357. }
  2358. }
  2359. options=options || {};
  2360. if (parameterCallback) {
  2361. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2362. }
  2363. return options;
  2364. };
  2365. };
  2366. OSF.DDA.AsyncMethodCallFactory=(function () {
  2367. return {
  2368. manufacture: function (params) {
  2369. var supportedOptions=params.supportedOptions ? OSF.OUtil.createObject(params.supportedOptions) : [];
  2370. var privateStateCallbacks=params.privateStateCallbacks ? OSF.OUtil.createObject(params.privateStateCallbacks) : [];
  2371. return new OSF.DDA.AsyncMethodCall(params.requiredArguments || [], supportedOptions, privateStateCallbacks, params.onSucceeded, params.onFailed, params.checkCallArgs, params.method.displayName);
  2372. }
  2373. };
  2374. })();
  2375. OSF.DDA.AsyncMethodCalls={};
  2376. OSF.DDA.AsyncMethodCalls.define=function (callDefinition) {
  2377. OSF.DDA.AsyncMethodCalls[callDefinition.method.id]=OSF.DDA.AsyncMethodCallFactory.manufacture(callDefinition);
  2378. };
  2379. OSF.DDA.Error=function OSF_DDA_Error(name, message, code) {
  2380. OSF.OUtil.defineEnumerableProperties(this, {
  2381. "name": {
  2382. value: name
  2383. },
  2384. "message": {
  2385. value: message
  2386. },
  2387. "code": {
  2388. value: code
  2389. }
  2390. });
  2391. };
  2392. OSF.DDA.AsyncResult=function OSF_DDA_AsyncResult(initArgs, errorArgs) {
  2393. OSF.OUtil.defineEnumerableProperties(this, {
  2394. "value": {
  2395. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Value]
  2396. },
  2397. "status": {
  2398. value: errorArgs ? Microsoft.Office.WebExtension.AsyncResultStatus.Failed : Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded
  2399. }
  2400. });
  2401. if (initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]) {
  2402. OSF.OUtil.defineEnumerableProperty(this, "asyncContext", {
  2403. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]
  2404. });
  2405. }
  2406. if (errorArgs) {
  2407. OSF.OUtil.defineEnumerableProperty(this, "error", {
  2408. value: new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code])
  2409. });
  2410. }
  2411. };
  2412. OSF.DDA.issueAsyncResult=function OSF_DDA$IssueAsyncResult(callArgs, status, payload) {
  2413. var callback=callArgs[Microsoft.Office.WebExtension.Parameters.Callback];
  2414. if (callback) {
  2415. var asyncInitArgs={};
  2416. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Context]=callArgs[Microsoft.Office.WebExtension.Parameters.AsyncContext];
  2417. var errorArgs;
  2418. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2419. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Value]=payload;
  2420. }
  2421. else {
  2422. errorArgs={};
  2423. payload=payload || OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  2424. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  2425. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  2426. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  2427. }
  2428. callback(new OSF.DDA.AsyncResult(asyncInitArgs, errorArgs));
  2429. }
  2430. };
  2431. OSF.DDA.SyncMethodNames={};
  2432. OSF.DDA.SyncMethodNames.addNames=function (methodNames) {
  2433. for (var entry in methodNames) {
  2434. var am={};
  2435. OSF.OUtil.defineEnumerableProperties(am, {
  2436. "id": {
  2437. value: entry
  2438. },
  2439. "displayName": {
  2440. value: methodNames[entry]
  2441. }
  2442. });
  2443. OSF.DDA.SyncMethodNames[entry]=am;
  2444. }
  2445. };
  2446. OSF.DDA.SyncMethodCall=function OSF_DDA_SyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2447. var requiredCount=requiredParameters.length;
  2448. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2449. function OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2450. if (userArgs.length > requiredCount+1) {
  2451. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2452. }
  2453. var options, parameterCallback;
  2454. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2455. var argument=userArgs[i];
  2456. switch (typeof argument) {
  2457. case "object":
  2458. if (options) {
  2459. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2460. }
  2461. else {
  2462. options=argument;
  2463. }
  2464. break;
  2465. default:
  2466. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2467. break;
  2468. }
  2469. }
  2470. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2471. apiMethods.verifyArguments(supportedOptions, options);
  2472. return options;
  2473. }
  2474. ;
  2475. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2476. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2477. var options=OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2478. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2479. return callArgs;
  2480. };
  2481. };
  2482. OSF.DDA.SyncMethodCallFactory=(function () {
  2483. return {
  2484. manufacture: function (params) {
  2485. var supportedOptions=params.supportedOptions ? OSF.OUtil.createObject(params.supportedOptions) : [];
  2486. return new OSF.DDA.SyncMethodCall(params.requiredArguments || [], supportedOptions, params.privateStateCallbacks, params.checkCallArgs, params.method.displayName);
  2487. }
  2488. };
  2489. })();
  2490. OSF.DDA.SyncMethodCalls={};
  2491. OSF.DDA.SyncMethodCalls.define=function (callDefinition) {
  2492. OSF.DDA.SyncMethodCalls[callDefinition.method.id]=OSF.DDA.SyncMethodCallFactory.manufacture(callDefinition);
  2493. };
  2494. OSF.DDA.ListType=(function () {
  2495. var listTypes={};
  2496. return {
  2497. setListType: function OSF_DDA_ListType$AddListType(t, prop) { listTypes[t]=prop; },
  2498. isListType: function OSF_DDA_ListType$IsListType(t) { return OSF.OUtil.listContainsKey(listTypes, t); },
  2499. getDescriptor: function OSF_DDA_ListType$getDescriptor(t) { return listTypes[t]; }
  2500. };
  2501. })();
  2502. OSF.DDA.HostParameterMap=function (specialProcessor, mappings) {
  2503. var toHostMap="toHost";
  2504. var fromHostMap="fromHost";
  2505. var sourceData="sourceData";
  2506. var self="self";
  2507. var dynamicTypes={};
  2508. dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data]={
  2509. toHost: function (data) {
  2510. if (data !=null && data.rows !==undefined) {
  2511. var tableData={};
  2512. tableData[OSF.DDA.TableDataProperties.TableRows]=data.rows;
  2513. tableData[OSF.DDA.TableDataProperties.TableHeaders]=data.headers;
  2514. data=tableData;
  2515. }
  2516. return data;
  2517. },
  2518. fromHost: function (args) {
  2519. return args;
  2520. }
  2521. };
  2522. dynamicTypes[Microsoft.Office.WebExtension.Parameters.SampleData]=dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data];
  2523. function mapValues(preimageSet, mapping) {
  2524. var ret=preimageSet ? {} : undefined;
  2525. for (var entry in preimageSet) {
  2526. var preimage=preimageSet[entry];
  2527. var image;
  2528. if (OSF.DDA.ListType.isListType(entry)) {
  2529. image=[];
  2530. for (var subEntry in preimage) {
  2531. image.push(mapValues(preimage[subEntry], mapping));
  2532. }
  2533. }
  2534. else if (OSF.OUtil.listContainsKey(dynamicTypes, entry)) {
  2535. image=dynamicTypes[entry][mapping](preimage);
  2536. }
  2537. else if (mapping==fromHostMap && specialProcessor.preserveNesting(entry)) {
  2538. image=mapValues(preimage, mapping);
  2539. }
  2540. else {
  2541. var maps=mappings[entry];
  2542. if (maps) {
  2543. var map=maps[mapping];
  2544. if (map) {
  2545. image=map[preimage];
  2546. if (image===undefined) {
  2547. image=preimage;
  2548. }
  2549. }
  2550. }
  2551. else {
  2552. image=preimage;
  2553. }
  2554. }
  2555. ret[entry]=image;
  2556. }
  2557. return ret;
  2558. }
  2559. ;
  2560. function generateArguments(imageSet, parameters) {
  2561. var ret;
  2562. for (var param in parameters) {
  2563. var arg;
  2564. if (specialProcessor.isComplexType(param)) {
  2565. arg=generateArguments(imageSet, mappings[param][toHostMap]);
  2566. }
  2567. else {
  2568. arg=imageSet[param];
  2569. }
  2570. if (arg !=undefined) {
  2571. if (!ret) {
  2572. ret={};
  2573. }
  2574. var index=parameters[param];
  2575. if (index==self) {
  2576. index=param;
  2577. }
  2578. ret[index]=specialProcessor.pack(param, arg);
  2579. }
  2580. }
  2581. return ret;
  2582. }
  2583. ;
  2584. function extractArguments(source, parameters, extracted) {
  2585. if (!extracted) {
  2586. extracted={};
  2587. }
  2588. for (var param in parameters) {
  2589. var index=parameters[param];
  2590. var value;
  2591. if (index==self) {
  2592. value=source;
  2593. }
  2594. else if (index==sourceData) {
  2595. extracted[param]=source.toArray();
  2596. continue;
  2597. }
  2598. else {
  2599. value=source[index];
  2600. }
  2601. if (value===null || value===undefined) {
  2602. extracted[param]=undefined;
  2603. }
  2604. else {
  2605. value=specialProcessor.unpack(param, value);
  2606. var map;
  2607. if (specialProcessor.isComplexType(param)) {
  2608. map=mappings[param][fromHostMap];
  2609. if (specialProcessor.preserveNesting(param)) {
  2610. extracted[param]=extractArguments(value, map);
  2611. }
  2612. else {
  2613. extractArguments(value, map, extracted);
  2614. }
  2615. }
  2616. else {
  2617. if (OSF.DDA.ListType.isListType(param)) {
  2618. map={};
  2619. var entryDescriptor=OSF.DDA.ListType.getDescriptor(param);
  2620. map[entryDescriptor]=self;
  2621. var extractedValues=new Array(value.length);
  2622. for (var item in value) {
  2623. extractedValues[item]=extractArguments(value[item], map);
  2624. }
  2625. extracted[param]=extractedValues;
  2626. }
  2627. else {
  2628. extracted[param]=value;
  2629. }
  2630. }
  2631. }
  2632. }
  2633. return extracted;
  2634. }
  2635. ;
  2636. function applyMap(mapName, preimage, mapping) {
  2637. var parameters=mappings[mapName][mapping];
  2638. var image;
  2639. if (mapping=="toHost") {
  2640. var imageSet=mapValues(preimage, mapping);
  2641. image=generateArguments(imageSet, parameters);
  2642. }
  2643. else if (mapping=="fromHost") {
  2644. var argumentSet=extractArguments(preimage, parameters);
  2645. image=mapValues(argumentSet, mapping);
  2646. }
  2647. return image;
  2648. }
  2649. ;
  2650. if (!mappings) {
  2651. mappings={};
  2652. }
  2653. this.addMapping=function (mapName, description) {
  2654. var toHost, fromHost;
  2655. if (description.map) {
  2656. toHost=description.map;
  2657. fromHost={};
  2658. for (var preimage in toHost) {
  2659. var image=toHost[preimage];
  2660. if (image==self) {
  2661. image=preimage;
  2662. }
  2663. fromHost[image]=preimage;
  2664. }
  2665. }
  2666. else {
  2667. toHost=description.toHost;
  2668. fromHost=description.fromHost;
  2669. }
  2670. var pair=mappings[mapName];
  2671. if (pair) {
  2672. var currMap=pair[toHostMap];
  2673. for (var th in currMap)
  2674. toHost[th]=currMap[th];
  2675. currMap=pair[fromHostMap];
  2676. for (var fh in currMap)
  2677. fromHost[fh]=currMap[fh];
  2678. }
  2679. else {
  2680. pair=mappings[mapName]={};
  2681. }
  2682. pair[toHostMap]=toHost;
  2683. pair[fromHostMap]=fromHost;
  2684. };
  2685. this.toHost=function (mapName, preimage) { return applyMap(mapName, preimage, toHostMap); };
  2686. this.fromHost=function (mapName, image) { return applyMap(mapName, image, fromHostMap); };
  2687. this.self=self;
  2688. this.sourceData=sourceData;
  2689. this.addComplexType=function (ct) { specialProcessor.addComplexType(ct); };
  2690. this.getDynamicType=function (dt) { return specialProcessor.getDynamicType(dt); };
  2691. this.setDynamicType=function (dt, handler) { specialProcessor.setDynamicType(dt, handler); };
  2692. this.dynamicTypes=dynamicTypes;
  2693. this.doMapValues=function (preimageSet, mapping) { return mapValues(preimageSet, mapping); };
  2694. };
  2695. OSF.DDA.SpecialProcessor=function (complexTypes, dynamicTypes) {
  2696. this.addComplexType=function OSF_DDA_SpecialProcessor$addComplexType(ct) {
  2697. complexTypes.push(ct);
  2698. };
  2699. this.getDynamicType=function OSF_DDA_SpecialProcessor$getDynamicType(dt) {
  2700. return dynamicTypes[dt];
  2701. };
  2702. this.setDynamicType=function OSF_DDA_SpecialProcessor$setDynamicType(dt, handler) {
  2703. dynamicTypes[dt]=handler;
  2704. };
  2705. this.isComplexType=function OSF_DDA_SpecialProcessor$isComplexType(t) {
  2706. return OSF.OUtil.listContainsValue(complexTypes, t);
  2707. };
  2708. this.isDynamicType=function OSF_DDA_SpecialProcessor$isDynamicType(p) {
  2709. return OSF.OUtil.listContainsKey(dynamicTypes, p);
  2710. };
  2711. this.preserveNesting=function OSF_DDA_SpecialProcessor$preserveNesting(p) {
  2712. var pn=[];
  2713. if (OSF.DDA.PropertyDescriptors)
  2714. pn.push(OSF.DDA.PropertyDescriptors.Subset);
  2715. if (OSF.DDA.DataNodeEventProperties) {
  2716. pn=pn.concat([
  2717. OSF.DDA.DataNodeEventProperties.OldNode,
  2718. OSF.DDA.DataNodeEventProperties.NewNode,
  2719. OSF.DDA.DataNodeEventProperties.NextSiblingNode
  2720. ]);
  2721. }
  2722. return OSF.OUtil.listContainsValue(pn, p);
  2723. };
  2724. this.pack=function OSF_DDA_SpecialProcessor$pack(param, arg) {
  2725. var value;
  2726. if (this.isDynamicType(param)) {
  2727. value=dynamicTypes[param].toHost(arg);
  2728. }
  2729. else {
  2730. value=arg;
  2731. }
  2732. return value;
  2733. };
  2734. this.unpack=function OSF_DDA_SpecialProcessor$unpack(param, arg) {
  2735. var value;
  2736. if (this.isDynamicType(param)) {
  2737. value=dynamicTypes[param].fromHost(arg);
  2738. }
  2739. else {
  2740. value=arg;
  2741. }
  2742. return value;
  2743. };
  2744. };
  2745. OSF.DDA.getDecoratedParameterMap=function (specialProcessor, initialDefs) {
  2746. var parameterMap=new OSF.DDA.HostParameterMap(specialProcessor);
  2747. var self=parameterMap.self;
  2748. function createObject(properties) {
  2749. var obj=null;
  2750. if (properties) {
  2751. obj={};
  2752. var len=properties.length;
  2753. for (var i=0; i < len; i++) {
  2754. obj[properties[i].name]=properties[i].value;
  2755. }
  2756. }
  2757. return obj;
  2758. }
  2759. parameterMap.define=function define(definition) {
  2760. var args={};
  2761. var toHost=createObject(definition.toHost);
  2762. if (definition.invertible) {
  2763. args.map=toHost;
  2764. }
  2765. else if (definition.canonical) {
  2766. args.toHost=args.fromHost=toHost;
  2767. }
  2768. else {
  2769. args.toHost=toHost;
  2770. args.fromHost=createObject(definition.fromHost);
  2771. }
  2772. parameterMap.addMapping(definition.type, args);
  2773. if (definition.isComplexType)
  2774. parameterMap.addComplexType(definition.type);
  2775. };
  2776. for (var id in initialDefs)
  2777. parameterMap.define(initialDefs[id]);
  2778. return parameterMap;
  2779. };
  2780. OSF.OUtil.setNamespace("DispIdHost", OSF.DDA);
  2781. OSF.DDA.DispIdHost.Methods={
  2782. InvokeMethod: "invokeMethod",
  2783. AddEventHandler: "addEventHandler",
  2784. RemoveEventHandler: "removeEventHandler",
  2785. OpenDialog: "openDialog",
  2786. CloseDialog: "closeDialog",
  2787. MessageParent: "messageParent",
  2788. SendMessage: "sendMessage"
  2789. };
  2790. OSF.DDA.DispIdHost.Delegates={
  2791. ExecuteAsync: "executeAsync",
  2792. RegisterEventAsync: "registerEventAsync",
  2793. UnregisterEventAsync: "unregisterEventAsync",
  2794. ParameterMap: "parameterMap",
  2795. OpenDialog: "openDialog",
  2796. CloseDialog: "closeDialog",
  2797. MessageParent: "messageParent",
  2798. SendMessage: "sendMessage"
  2799. };
  2800. OSF.DDA.DispIdHost.Facade=function OSF_DDA_DispIdHost_Facade(getDelegateMethods, parameterMap) {
  2801. var dispIdMap={};
  2802. var jsom=OSF.DDA.AsyncMethodNames;
  2803. var did=OSF.DDA.MethodDispId;
  2804. var methodMap={
  2805. "GoToByIdAsync": did.dispidNavigateToMethod,
  2806. "GetSelectedDataAsync": did.dispidGetSelectedDataMethod,
  2807. "SetSelectedDataAsync": did.dispidSetSelectedDataMethod,
  2808. "GetDocumentCopyChunkAsync": did.dispidGetDocumentCopyChunkMethod,
  2809. "ReleaseDocumentCopyAsync": did.dispidReleaseDocumentCopyMethod,
  2810. "GetDocumentCopyAsync": did.dispidGetDocumentCopyMethod,
  2811. "AddFromSelectionAsync": did.dispidAddBindingFromSelectionMethod,
  2812. "AddFromPromptAsync": did.dispidAddBindingFromPromptMethod,
  2813. "AddFromNamedItemAsync": did.dispidAddBindingFromNamedItemMethod,
  2814. "GetAllAsync": did.dispidGetAllBindingsMethod,
  2815. "GetByIdAsync": did.dispidGetBindingMethod,
  2816. "ReleaseByIdAsync": did.dispidReleaseBindingMethod,
  2817. "GetDataAsync": did.dispidGetBindingDataMethod,
  2818. "SetDataAsync": did.dispidSetBindingDataMethod,
  2819. "AddRowsAsync": did.dispidAddRowsMethod,
  2820. "AddColumnsAsync": did.dispidAddColumnsMethod,
  2821. "DeleteAllDataValuesAsync": did.dispidClearAllRowsMethod,
  2822. "RefreshAsync": did.dispidLoadSettingsMethod,
  2823. "SaveAsync": did.dispidSaveSettingsMethod,
  2824. "GetActiveViewAsync": did.dispidGetActiveViewMethod,
  2825. "GetFilePropertiesAsync": did.dispidGetFilePropertiesMethod,
  2826. "GetOfficeThemeAsync": did.dispidGetOfficeThemeMethod,
  2827. "GetDocumentThemeAsync": did.dispidGetDocumentThemeMethod,
  2828. "ClearFormatsAsync": did.dispidClearFormatsMethod,
  2829. "SetTableOptionsAsync": did.dispidSetTableOptionsMethod,
  2830. "SetFormatsAsync": did.dispidSetFormatsMethod,
  2831. "ExecuteRichApiRequestAsync": did.dispidExecuteRichApiRequestMethod,
  2832. "AppCommandInvocationCompletedAsync": did.dispidAppCommandInvocationCompletedMethod,
  2833. "CloseContainerAsync": did.dispidCloseContainerMethod,
  2834. "AddDataPartAsync": did.dispidAddDataPartMethod,
  2835. "GetDataPartByIdAsync": did.dispidGetDataPartByIdMethod,
  2836. "GetDataPartsByNameSpaceAsync": did.dispidGetDataPartsByNamespaceMethod,
  2837. "GetPartXmlAsync": did.dispidGetDataPartXmlMethod,
  2838. "GetPartNodesAsync": did.dispidGetDataPartNodesMethod,
  2839. "DeleteDataPartAsync": did.dispidDeleteDataPartMethod,
  2840. "GetNodeValueAsync": did.dispidGetDataNodeValueMethod,
  2841. "GetNodeXmlAsync": did.dispidGetDataNodeXmlMethod,
  2842. "GetRelativeNodesAsync": did.dispidGetDataNodesMethod,
  2843. "SetNodeValueAsync": did.dispidSetDataNodeValueMethod,
  2844. "SetNodeXmlAsync": did.dispidSetDataNodeXmlMethod,
  2845. "AddDataPartNamespaceAsync": did.dispidAddDataNamespaceMethod,
  2846. "GetDataPartNamespaceAsync": did.dispidGetDataUriByPrefixMethod,
  2847. "GetDataPartPrefixAsync": did.dispidGetDataPrefixByUriMethod,
  2848. "GetNodeTextAsync": did.dispidGetDataNodeTextMethod,
  2849. "SetNodeTextAsync": did.dispidSetDataNodeTextMethod,
  2850. "GetSelectedTask": did.dispidGetSelectedTaskMethod,
  2851. "GetTask": did.dispidGetTaskMethod,
  2852. "GetWSSUrl": did.dispidGetWSSUrlMethod,
  2853. "GetTaskField": did.dispidGetTaskFieldMethod,
  2854. "GetSelectedResource": did.dispidGetSelectedResourceMethod,
  2855. "GetResourceField": did.dispidGetResourceFieldMethod,
  2856. "GetProjectField": did.dispidGetProjectFieldMethod,
  2857. "GetSelectedView": did.dispidGetSelectedViewMethod,
  2858. "GetTaskByIndex": did.dispidGetTaskByIndexMethod,
  2859. "GetResourceByIndex": did.dispidGetResourceByIndexMethod,
  2860. "SetTaskField": did.dispidSetTaskFieldMethod,
  2861. "SetResourceField": did.dispidSetResourceFieldMethod,
  2862. "GetMaxTaskIndex": did.dispidGetMaxTaskIndexMethod,
  2863. "GetMaxResourceIndex": did.dispidGetMaxResourceIndexMethod,
  2864. "CreateTask": did.dispidCreateTaskMethod
  2865. };
  2866. for (var method in methodMap) {
  2867. if (jsom[method]) {
  2868. dispIdMap[jsom[method].id]=methodMap[method];
  2869. }
  2870. }
  2871. jsom=OSF.DDA.SyncMethodNames;
  2872. did=OSF.DDA.MethodDispId;
  2873. var asyncMethodMap={
  2874. "MessageParent": did.dispidMessageParentMethod,
  2875. "SendMessage": did.dispidSendMessageMethod
  2876. };
  2877. for (var method in asyncMethodMap) {
  2878. if (jsom[method]) {
  2879. dispIdMap[jsom[method].id]=asyncMethodMap[method];
  2880. }
  2881. }
  2882. jsom=Microsoft.Office.WebExtension.EventType;
  2883. did=OSF.DDA.EventDispId;
  2884. var eventMap={
  2885. "SettingsChanged": did.dispidSettingsChangedEvent,
  2886. "DocumentSelectionChanged": did.dispidDocumentSelectionChangedEvent,
  2887. "BindingSelectionChanged": did.dispidBindingSelectionChangedEvent,
  2888. "BindingDataChanged": did.dispidBindingDataChangedEvent,
  2889. "ActiveViewChanged": did.dispidActiveViewChangedEvent,
  2890. "OfficeThemeChanged": did.dispidOfficeThemeChangedEvent,
  2891. "DocumentThemeChanged": did.dispidDocumentThemeChangedEvent,
  2892. "AppCommandInvoked": did.dispidAppCommandInvokedEvent,
  2893. "DialogMessageReceived": did.dispidDialogMessageReceivedEvent,
  2894. "DialogParentMessageReceived": did.dispidDialogParentMessageReceivedEvent,
  2895. "ItemChanged": did.dispidOlkItemSelectedChangedEvent,
  2896. "TaskSelectionChanged": did.dispidTaskSelectionChangedEvent,
  2897. "ResourceSelectionChanged": did.dispidResourceSelectionChangedEvent,
  2898. "ViewSelectionChanged": did.dispidViewSelectionChangedEvent,
  2899. "DataNodeInserted": did.dispidDataNodeAddedEvent,
  2900. "DataNodeReplaced": did.dispidDataNodeReplacedEvent,
  2901. "DataNodeDeleted": did.dispidDataNodeDeletedEvent
  2902. };
  2903. for (var event in eventMap) {
  2904. if (jsom[event]) {
  2905. dispIdMap[jsom[event]]=eventMap[event];
  2906. }
  2907. }
  2908. function onException(ex, asyncMethodCall, suppliedArgs, callArgs) {
  2909. if (typeof ex=="number") {
  2910. if (!callArgs) {
  2911. callArgs=asyncMethodCall.getCallArgs(suppliedArgs);
  2912. }
  2913. OSF.DDA.issueAsyncResult(callArgs, ex, OSF.DDA.ErrorCodeManager.getErrorArgs(ex));
  2914. }
  2915. else {
  2916. throw ex;
  2917. }
  2918. }
  2919. ;
  2920. this[OSF.DDA.DispIdHost.Methods.InvokeMethod]=function OSF_DDA_DispIdHost_Facade$InvokeMethod(method, suppliedArguments, caller, privateState) {
  2921. var callArgs;
  2922. try {
  2923. var methodName=method.id;
  2924. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[methodName];
  2925. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, privateState);
  2926. var dispId=dispIdMap[methodName];
  2927. var delegate=getDelegateMethods(methodName);
  2928. var richApiInExcelMethodSubstitution=null;
  2929. if (window.Excel && window.Office.context.requirements.isSetSupported("RedirectV1Api")) {
  2930. window.Excel._RedirectV1APIs=true;
  2931. }
  2932. if (window.Excel && window.Excel._RedirectV1APIs && (richApiInExcelMethodSubstitution=window.Excel._V1APIMap[methodName])) {
  2933. if (richApiInExcelMethodSubstitution.preprocess) {
  2934. callArgs=richApiInExcelMethodSubstitution.preprocess(callArgs);
  2935. }
  2936. var ctx=new window.Excel.RequestContext();
  2937. var result=richApiInExcelMethodSubstitution.call(ctx, callArgs);
  2938. ctx.sync()
  2939. .then(function () {
  2940. var response=result.value;
  2941. var status=response.status;
  2942. delete response["status"];
  2943. delete response["@odata.type"];
  2944. if (richApiInExcelMethodSubstitution.postprocess) {
  2945. response=richApiInExcelMethodSubstitution.postprocess(response, callArgs);
  2946. }
  2947. if (status !=0) {
  2948. response=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2949. }
  2950. OSF.DDA.issueAsyncResult(callArgs, status, response);
  2951. })["catch"](function (error) {
  2952. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeFailure, null);
  2953. });
  2954. }
  2955. else {
  2956. var hostCallArgs;
  2957. if (parameterMap.toHost) {
  2958. hostCallArgs=parameterMap.toHost(dispId, callArgs);
  2959. }
  2960. else {
  2961. hostCallArgs=callArgs;
  2962. }
  2963. delegate[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]({
  2964. "dispId": dispId,
  2965. "hostCallArgs": hostCallArgs,
  2966. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { },
  2967. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { },
  2968. "onComplete": function (status, hostResponseArgs) {
  2969. var responseArgs;
  2970. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2971. if (parameterMap.fromHost) {
  2972. responseArgs=parameterMap.fromHost(dispId, hostResponseArgs);
  2973. }
  2974. else {
  2975. responseArgs=hostResponseArgs;
  2976. }
  2977. }
  2978. else {
  2979. responseArgs=hostResponseArgs;
  2980. }
  2981. var payload=asyncMethodCall.processResponse(status, responseArgs, caller, callArgs);
  2982. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  2983. }
  2984. });
  2985. }
  2986. }
  2987. catch (ex) {
  2988. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  2989. }
  2990. };
  2991. this[OSF.DDA.DispIdHost.Methods.AddEventHandler]=function OSF_DDA_DispIdHost_Facade$AddEventHandler(suppliedArguments, eventDispatch, caller, isPopupWindow) {
  2992. var callArgs;
  2993. var eventType, handler;
  2994. function onEnsureRegistration(status) {
  2995. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2996. var added=eventDispatch.addEventHandler(eventType, handler);
  2997. if (!added) {
  2998. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerAdditionFailed;
  2999. }
  3000. }
  3001. var error;
  3002. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3003. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3004. }
  3005. OSF.DDA.issueAsyncResult(callArgs, status, error);
  3006. }
  3007. try {
  3008. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.AddHandlerAsync.id];
  3009. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3010. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  3011. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  3012. if (isPopupWindow) {
  3013. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  3014. return;
  3015. }
  3016. if (eventDispatch.getEventHandlerCount(eventType)==0) {
  3017. var dispId=dispIdMap[eventType];
  3018. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  3019. invoker({
  3020. "eventType": eventType,
  3021. "dispId": dispId,
  3022. "targetId": caller.id || "",
  3023. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3024. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3025. "onComplete": onEnsureRegistration,
  3026. "onEvent": function handleEvent(hostArgs) {
  3027. var args=parameterMap.fromHost(dispId, hostArgs);
  3028. eventDispatch.fireEvent(OSF.DDA.OMFactory.manufactureEventArgs(eventType, caller, args));
  3029. }
  3030. });
  3031. }
  3032. else {
  3033. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  3034. }
  3035. }
  3036. catch (ex) {
  3037. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3038. }
  3039. };
  3040. this[OSF.DDA.DispIdHost.Methods.RemoveEventHandler]=function OSF_DDA_DispIdHost_Facade$RemoveEventHandler(suppliedArguments, eventDispatch, caller) {
  3041. var callArgs;
  3042. var eventType, handler;
  3043. function onEnsureRegistration(status) {
  3044. var error;
  3045. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3046. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3047. }
  3048. OSF.DDA.issueAsyncResult(callArgs, status, error);
  3049. }
  3050. try {
  3051. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.id];
  3052. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3053. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  3054. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  3055. var status, removeSuccess;
  3056. if (handler===null) {
  3057. removeSuccess=eventDispatch.clearEventHandlers(eventType);
  3058. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3059. }
  3060. else {
  3061. removeSuccess=eventDispatch.removeEventHandler(eventType, handler);
  3062. status=removeSuccess ? OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess : OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist;
  3063. }
  3064. if (removeSuccess && eventDispatch.getEventHandlerCount(eventType)==0) {
  3065. var dispId=dispIdMap[eventType];
  3066. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  3067. invoker({
  3068. "eventType": eventType,
  3069. "dispId": dispId,
  3070. "targetId": caller.id || "",
  3071. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3072. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3073. "onComplete": onEnsureRegistration
  3074. });
  3075. }
  3076. else {
  3077. onEnsureRegistration(status);
  3078. }
  3079. }
  3080. catch (ex) {
  3081. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3082. }
  3083. };
  3084. this[OSF.DDA.DispIdHost.Methods.OpenDialog]=function OSF_DDA_DispIdHost_Facade$OpenDialog(suppliedArguments, eventDispatch, caller) {
  3085. var callArgs;
  3086. var targetId;
  3087. var dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  3088. var dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  3089. function onEnsureRegistration(status) {
  3090. var payload;
  3091. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3092. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3093. }
  3094. else {
  3095. var onSucceedArgs={};
  3096. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Id]=targetId;
  3097. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Data]=eventDispatch;
  3098. var payload=asyncMethodCall.processResponse(status, onSucceedArgs, caller, callArgs);
  3099. OSF.DialogShownStatus.hasDialogShown=true;
  3100. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3101. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3102. }
  3103. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  3104. }
  3105. try {
  3106. if (dialogMessageEvent==undefined || dialogOtherEvent==undefined) {
  3107. onEnsureRegistration(OSF.DDA.ErrorCodeManager.ooeOperationNotSupported);
  3108. }
  3109. if (OSF.DDA.AsyncMethodNames.DisplayDialogAsync==null) {
  3110. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  3111. return;
  3112. }
  3113. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.DisplayDialogAsync.id];
  3114. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3115. var dispId=dispIdMap[dialogMessageEvent];
  3116. var delegateMethods=getDelegateMethods(dialogMessageEvent);
  3117. var invoker=delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog] !=undefined ?
  3118. delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog] :
  3119. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  3120. targetId=JSON.stringify(callArgs);
  3121. invoker({
  3122. "eventType": dialogMessageEvent,
  3123. "dispId": dispId,
  3124. "targetId": targetId,
  3125. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3126. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3127. "onComplete": onEnsureRegistration,
  3128. "onEvent": function handleEvent(hostArgs) {
  3129. var args=parameterMap.fromHost(dispId, hostArgs);
  3130. var event=OSF.DDA.OMFactory.manufactureEventArgs(dialogMessageEvent, caller, args);
  3131. if (event.type==dialogOtherEvent) {
  3132. var payload=OSF.DDA.ErrorCodeManager.getErrorArgs(event.error);
  3133. var errorArgs={};
  3134. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3135. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  3136. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  3137. event.error=new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]);
  3138. }
  3139. eventDispatch.fireOrQueueEvent(event);
  3140. if (args[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogClosed) {
  3141. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3142. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3143. eventDispatch.clearEventHandlers(Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived);
  3144. OSF.DialogShownStatus.hasDialogShown=false;
  3145. }
  3146. }
  3147. });
  3148. }
  3149. catch (ex) {
  3150. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3151. }
  3152. };
  3153. this[OSF.DDA.DispIdHost.Methods.CloseDialog]=function OSF_DDA_DispIdHost_Facade$CloseDialog(suppliedArguments, targetId, eventDispatch, caller) {
  3154. var callArgs;
  3155. var dialogMessageEvent, dialogOtherEvent;
  3156. var closeStatus=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3157. function closeCallback(status) {
  3158. closeStatus=status;
  3159. OSF.DialogShownStatus.hasDialogShown=false;
  3160. }
  3161. try {
  3162. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.CloseAsync.id];
  3163. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3164. dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  3165. dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  3166. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3167. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3168. var dispId=dispIdMap[dialogMessageEvent];
  3169. var delegateMethods=getDelegateMethods(dialogMessageEvent);
  3170. var invoker=delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog] !=undefined ?
  3171. delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog] :
  3172. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  3173. invoker({
  3174. "eventType": dialogMessageEvent,
  3175. "dispId": dispId,
  3176. "targetId": targetId,
  3177. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3178. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3179. "onComplete": closeCallback
  3180. });
  3181. }
  3182. catch (ex) {
  3183. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3184. }
  3185. if (closeStatus !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3186. throw OSF.OUtil.formatString(Strings.OfficeOM.L_FunctionCallFailed, OSF.DDA.AsyncMethodNames.CloseAsync.displayName, closeStatus);
  3187. }
  3188. };
  3189. this[OSF.DDA.DispIdHost.Methods.MessageParent]=function OSF_DDA_DispIdHost_Facade$MessageParent(suppliedArguments, caller) {
  3190. var stateInfo={};
  3191. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.MessageParent.id];
  3192. var callArgs=syncMethodCall.verifyAndExtractCall(suppliedArguments, caller, stateInfo);
  3193. var delegate=getDelegateMethods(OSF.DDA.SyncMethodNames.MessageParent.id);
  3194. var invoker=delegate[OSF.DDA.DispIdHost.Delegates.MessageParent];
  3195. var dispId=dispIdMap[OSF.DDA.SyncMethodNames.MessageParent.id];
  3196. return invoker({
  3197. "dispId": dispId,
  3198. "hostCallArgs": callArgs,
  3199. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3200. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); }
  3201. });
  3202. };
  3203. this[OSF.DDA.DispIdHost.Methods.SendMessage]=function OSF_DDA_DispIdHost_Facade$SendMessage(suppliedArguments, eventDispatch, caller) {
  3204. var stateInfo={};
  3205. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.SendMessage.id];
  3206. var callArgs=syncMethodCall.verifyAndExtractCall(suppliedArguments, caller, stateInfo);
  3207. var delegate=getDelegateMethods(OSF.DDA.SyncMethodNames.SendMessage.id);
  3208. var invoker=delegate[OSF.DDA.DispIdHost.Delegates.SendMessage];
  3209. var dispId=dispIdMap[OSF.DDA.SyncMethodNames.SendMessage.id];
  3210. return invoker({
  3211. "dispId": dispId,
  3212. "hostCallArgs": callArgs,
  3213. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3214. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); }
  3215. });
  3216. };
  3217. };
  3218. OSF.DDA.DispIdHost.addAsyncMethods=function OSF_DDA_DispIdHost$AddAsyncMethods(target, asyncMethodNames, privateState) {
  3219. for (var entry in asyncMethodNames) {
  3220. var method=asyncMethodNames[entry];
  3221. var name=method.displayName;
  3222. if (!target[name]) {
  3223. OSF.OUtil.defineEnumerableProperty(target, name, {
  3224. value: (function (asyncMethod) {
  3225. return function () {
  3226. var invokeMethod=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.InvokeMethod];
  3227. invokeMethod(asyncMethod, arguments, target, privateState);
  3228. };
  3229. })(method)
  3230. });
  3231. }
  3232. }
  3233. };
  3234. OSF.DDA.DispIdHost.addEventSupport=function OSF_DDA_DispIdHost$AddEventSupport(target, eventDispatch, isPopupWindow) {
  3235. var add=OSF.DDA.AsyncMethodNames.AddHandlerAsync.displayName;
  3236. var remove=OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.displayName;
  3237. if (!target[add]) {
  3238. OSF.OUtil.defineEnumerableProperty(target, add, {
  3239. value: function () {
  3240. var addEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.AddEventHandler];
  3241. addEventHandler(arguments, eventDispatch, target, isPopupWindow);
  3242. }
  3243. });
  3244. }
  3245. if (!target[remove]) {
  3246. OSF.OUtil.defineEnumerableProperty(target, remove, {
  3247. value: function () {
  3248. var removeEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.RemoveEventHandler];
  3249. removeEventHandler(arguments, eventDispatch, target);
  3250. }
  3251. });
  3252. }
  3253. };
  3254. OSF.ShowWindowDialogParameterKeys={
  3255. Url: "url",
  3256. Width: "width",
  3257. Height: "height",
  3258. DisplayInIframe: "displayInIframe"
  3259. };
  3260. OSF.HostThemeButtonStyleKeys={
  3261. ButtonBorderColor: "buttonBorderColor",
  3262. ButtonBackgroundColor: "buttonBackgroundColor"
  3263. };
  3264. var OfficeExt;
  3265. (function (OfficeExt) {
  3266. var WACUtils;
  3267. (function (WACUtils) {
  3268. var _trustedDomain="^https:\/\/[a-zA-Z0-9]+\.(officeapps\.live|officeapps-df\.live|partner\.officewebapps)\.com\/";
  3269. function parseAppContextFromWindowName(skipSessionStorage, windowName) {
  3270. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.AppContext);
  3271. }
  3272. WACUtils.parseAppContextFromWindowName=parseAppContextFromWindowName;
  3273. function serializeObjectToString(response) {
  3274. if (typeof (JSON) !=="undefined") {
  3275. try {
  3276. return JSON.stringify(response);
  3277. }
  3278. catch (ex) {
  3279. }
  3280. }
  3281. return "";
  3282. }
  3283. WACUtils.serializeObjectToString=serializeObjectToString;
  3284. function isHostTrusted() {
  3285. return (new RegExp(_trustedDomain)).test(OSF.getClientEndPoint()._targetUrl);
  3286. }
  3287. WACUtils.isHostTrusted=isHostTrusted;
  3288. function addHostInfoAsQueryParam(url, hostInfoValue) {
  3289. if (!url) {
  3290. return null;
  3291. }
  3292. url=url.trim() || '';
  3293. var questionMark="?";
  3294. var hostInfo="_host_Info=";
  3295. var ampHostInfo="&_host_Info=";
  3296. var fragmentSeparator="#";
  3297. var urlParts=url.split(fragmentSeparator);
  3298. var urlWithoutFragment=urlParts.shift();
  3299. var fragment=urlParts.join(fragmentSeparator);
  3300. var querySplits=urlWithoutFragment.split(questionMark);
  3301. var urlWithoutFragmentWithHostInfo;
  3302. if (querySplits.length > 1) {
  3303. urlWithoutFragmentWithHostInfo=urlWithoutFragment+ampHostInfo+hostInfoValue;
  3304. }
  3305. else if (querySplits.length > 0) {
  3306. urlWithoutFragmentWithHostInfo=urlWithoutFragment+questionMark+hostInfo+hostInfoValue;
  3307. }
  3308. return [urlWithoutFragmentWithHostInfo, fragmentSeparator, fragment].join('');
  3309. }
  3310. WACUtils.addHostInfoAsQueryParam=addHostInfoAsQueryParam;
  3311. function getDomainForUrl(url) {
  3312. if (!url) {
  3313. return null;
  3314. }
  3315. var url_parser=document.createElement('a');
  3316. url_parser.href=url;
  3317. return url_parser.protocol+"//"+url_parser.host;
  3318. }
  3319. WACUtils.getDomainForUrl=getDomainForUrl;
  3320. })(WACUtils=OfficeExt.WACUtils || (OfficeExt.WACUtils={}));
  3321. })(OfficeExt || (OfficeExt={}));
  3322. var OfficeExt;
  3323. (function (OfficeExt) {
  3324. var MsAjaxTypeHelper=(function () {
  3325. function MsAjaxTypeHelper() {
  3326. }
  3327. MsAjaxTypeHelper.isInstanceOfType=function (type, instance) {
  3328. if (typeof (instance)==="undefined" || instance===null)
  3329. return false;
  3330. if (instance instanceof type)
  3331. return true;
  3332. var instanceType=instance.constructor;
  3333. if (!instanceType || (typeof (instanceType) !=="function") || !instanceType.__typeName || instanceType.__typeName==='Object') {
  3334. instanceType=Object;
  3335. }
  3336. return !!(instanceType===type) ||
  3337. (instanceType.__typeName && type.__typeName && instanceType.__typeName===type.__typeName);
  3338. };
  3339. return MsAjaxTypeHelper;
  3340. })();
  3341. OfficeExt.MsAjaxTypeHelper=MsAjaxTypeHelper;
  3342. var MsAjaxError=(function () {
  3343. function MsAjaxError() {
  3344. }
  3345. MsAjaxError.create=function (message, errorInfo) {
  3346. var err=new Error(message);
  3347. err.message=message;
  3348. if (errorInfo) {
  3349. for (var v in errorInfo) {
  3350. err[v]=errorInfo[v];
  3351. }
  3352. }
  3353. err.popStackFrame();
  3354. return err;
  3355. };
  3356. MsAjaxError.parameterCount=function (message) {
  3357. var displayMessage="Sys.ParameterCountException: "+(message ? message : "Parameter count mismatch.");
  3358. var err=MsAjaxError.create(displayMessage, { name: 'Sys.ParameterCountException' });
  3359. err.popStackFrame();
  3360. return err;
  3361. };
  3362. MsAjaxError.argument=function (paramName, message) {
  3363. var displayMessage="Sys.ArgumentException: "+(message ? message : "Value does not fall within the expected range.");
  3364. if (paramName) {
  3365. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3366. }
  3367. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
  3368. err.popStackFrame();
  3369. return err;
  3370. };
  3371. MsAjaxError.argumentNull=function (paramName, message) {
  3372. var displayMessage="Sys.ArgumentNullException: "+(message ? message : "Value cannot be null.");
  3373. if (paramName) {
  3374. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3375. }
  3376. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
  3377. err.popStackFrame();
  3378. return err;
  3379. };
  3380. MsAjaxError.argumentOutOfRange=function (paramName, actualValue, message) {
  3381. var displayMessage="Sys.ArgumentOutOfRangeException: "+(message ? message : "Specified argument was out of the range of valid values.");
  3382. if (paramName) {
  3383. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3384. }
  3385. if (typeof (actualValue) !=="undefined" && actualValue !==null) {
  3386. displayMessage+="\n"+MsAjaxString.format("Actual value was {0}.", actualValue);
  3387. }
  3388. var err=MsAjaxError.create(displayMessage, {
  3389. name: "Sys.ArgumentOutOfRangeException",
  3390. paramName: paramName,
  3391. actualValue: actualValue
  3392. });
  3393. err.popStackFrame();
  3394. return err;
  3395. };
  3396. MsAjaxError.argumentType=function (paramName, actualType, expectedType, message) {
  3397. var displayMessage="Sys.ArgumentTypeException: ";
  3398. if (message) {
  3399. displayMessage+=message;
  3400. }
  3401. else if (actualType && expectedType) {
  3402. displayMessage+=MsAjaxString.format("Object of type '{0}' cannot be converted to type '{1}'.", actualType.getName ? actualType.getName() : actualType, expectedType.getName ? expectedType.getName() : expectedType);
  3403. }
  3404. else {
  3405. displayMessage+="Object cannot be converted to the required type.";
  3406. }
  3407. if (paramName) {
  3408. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3409. }
  3410. var err=MsAjaxError.create(displayMessage, {
  3411. name: "Sys.ArgumentTypeException",
  3412. paramName: paramName,
  3413. actualType: actualType,
  3414. expectedType: expectedType
  3415. });
  3416. err.popStackFrame();
  3417. return err;
  3418. };
  3419. MsAjaxError.argumentUndefined=function (paramName, message) {
  3420. var displayMessage="Sys.ArgumentUndefinedException: "+(message ? message : "Value cannot be undefined.");
  3421. if (paramName) {
  3422. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3423. }
  3424. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
  3425. err.popStackFrame();
  3426. return err;
  3427. };
  3428. MsAjaxError.invalidOperation=function (message) {
  3429. var displayMessage="Sys.InvalidOperationException: "+(message ? message : "Operation is not valid due to the current state of the object.");
  3430. var err=MsAjaxError.create(displayMessage, { name: 'Sys.InvalidOperationException' });
  3431. err.popStackFrame();
  3432. return err;
  3433. };
  3434. return MsAjaxError;
  3435. })();
  3436. OfficeExt.MsAjaxError=MsAjaxError;
  3437. var MsAjaxString=(function () {
  3438. function MsAjaxString() {
  3439. }
  3440. MsAjaxString.format=function (format) {
  3441. var args=[];
  3442. for (var _i=1; _i < arguments.length; _i++) {
  3443. args[_i - 1]=arguments[_i];
  3444. }
  3445. var source=format;
  3446. return source.replace(/{(\d+)}/gm, function (match, number) {
  3447. var index=parseInt(number, 10);
  3448. return args[index]===undefined ? '{'+number+'}' : args[index];
  3449. });
  3450. };
  3451. MsAjaxString.startsWith=function (str, prefix) {
  3452. return (str.substr(0, prefix.length)===prefix);
  3453. };
  3454. return MsAjaxString;
  3455. })();
  3456. OfficeExt.MsAjaxString=MsAjaxString;
  3457. var MsAjaxDebug=(function () {
  3458. function MsAjaxDebug() {
  3459. }
  3460. MsAjaxDebug.trace=function (text) {
  3461. if (typeof Debug !=="undefined" && Debug.writeln)
  3462. Debug.writeln(text);
  3463. if (window.console && window.console.log)
  3464. window.console.log(text);
  3465. if (window.opera && window.opera.postError)
  3466. window.opera.postError(text);
  3467. if (window.debugService && window.debugService.trace)
  3468. window.debugService.trace(text);
  3469. var a=document.getElementById("TraceConsole");
  3470. if (a && a.tagName.toUpperCase()==="TEXTAREA") {
  3471. a.innerHTML+=text+"\n";
  3472. }
  3473. };
  3474. return MsAjaxDebug;
  3475. })();
  3476. OfficeExt.MsAjaxDebug=MsAjaxDebug;
  3477. if (!OsfMsAjaxFactory.isMsAjaxLoaded()) {
  3478. var registerTypeInternal=function registerTypeInternal(type, name, isClass) {
  3479. if (type.__typeName===undefined) {
  3480. type.__typeName=name;
  3481. }
  3482. if (type.__class===undefined) {
  3483. type.__class=isClass;
  3484. }
  3485. };
  3486. registerTypeInternal(Function, "Function", true);
  3487. registerTypeInternal(Error, "Error", true);
  3488. registerTypeInternal(Object, "Object", true);
  3489. registerTypeInternal(String, "String", true);
  3490. registerTypeInternal(Boolean, "Boolean", true);
  3491. registerTypeInternal(Date, "Date", true);
  3492. registerTypeInternal(Number, "Number", true);
  3493. registerTypeInternal(RegExp, "RegExp", true);
  3494. registerTypeInternal(Array, "Array", true);
  3495. if (!Function.createCallback) {
  3496. Function.createCallback=function Function$createCallback(method, context) {
  3497. var e=Function._validateParams(arguments, [
  3498. { name: "method", type: Function },
  3499. { name: "context", mayBeNull: true }
  3500. ]);
  3501. if (e)
  3502. throw e;
  3503. return function () {
  3504. var l=arguments.length;
  3505. if (l > 0) {
  3506. var args=[];
  3507. for (var i=0; i < l; i++) {
  3508. args[i]=arguments[i];
  3509. }
  3510. args[l]=context;
  3511. return method.apply(this, args);
  3512. }
  3513. return method.call(this, context);
  3514. };
  3515. };
  3516. }
  3517. if (!Function.createDelegate) {
  3518. Function.createDelegate=function Function$createDelegate(instance, method) {
  3519. var e=Function._validateParams(arguments, [
  3520. { name: "instance", mayBeNull: true },
  3521. { name: "method", type: Function }
  3522. ]);
  3523. if (e)
  3524. throw e;
  3525. return function () {
  3526. return method.apply(instance, arguments);
  3527. };
  3528. };
  3529. }
  3530. if (!Function._validateParams) {
  3531. Function._validateParams=function (params, expectedParams, validateParameterCount) {
  3532. var e, expectedLength=expectedParams.length;
  3533. validateParameterCount=validateParameterCount || (typeof (validateParameterCount)==="undefined");
  3534. e=Function._validateParameterCount(params, expectedParams, validateParameterCount);
  3535. if (e) {
  3536. e.popStackFrame();
  3537. return e;
  3538. }
  3539. for (var i=0, l=params.length; i < l; i++) {
  3540. var expectedParam=expectedParams[Math.min(i, expectedLength - 1)], paramName=expectedParam.name;
  3541. if (expectedParam.parameterArray) {
  3542. paramName+="["+(i - expectedLength+1)+"]";
  3543. }
  3544. else if (!validateParameterCount && (i >=expectedLength)) {
  3545. break;
  3546. }
  3547. e=Function._validateParameter(params[i], expectedParam, paramName);
  3548. if (e) {
  3549. e.popStackFrame();
  3550. return e;
  3551. }
  3552. }
  3553. return null;
  3554. };
  3555. }
  3556. if (!Function._validateParameterCount) {
  3557. Function._validateParameterCount=function (params, expectedParams, validateParameterCount) {
  3558. var i, error, expectedLen=expectedParams.length, actualLen=params.length;
  3559. if (actualLen < expectedLen) {
  3560. var minParams=expectedLen;
  3561. for (i=0; i < expectedLen; i++) {
  3562. var param=expectedParams[i];
  3563. if (param.optional || param.parameterArray) {
  3564. minParams--;
  3565. }
  3566. }
  3567. if (actualLen < minParams) {
  3568. error=true;
  3569. }
  3570. }
  3571. else if (validateParameterCount && (actualLen > expectedLen)) {
  3572. error=true;
  3573. for (i=0; i < expectedLen; i++) {
  3574. if (expectedParams[i].parameterArray) {
  3575. error=false;
  3576. break;
  3577. }
  3578. }
  3579. }
  3580. if (error) {
  3581. var e=MsAjaxError.parameterCount();
  3582. e.popStackFrame();
  3583. return e;
  3584. }
  3585. return null;
  3586. };
  3587. }
  3588. if (!Function._validateParameter) {
  3589. Function._validateParameter=function (param, expectedParam, paramName) {
  3590. var e, expectedType=expectedParam.type, expectedInteger=!!expectedParam.integer, expectedDomElement=!!expectedParam.domElement, mayBeNull=!!expectedParam.mayBeNull;
  3591. e=Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
  3592. if (e) {
  3593. e.popStackFrame();
  3594. return e;
  3595. }
  3596. var expectedElementType=expectedParam.elementType, elementMayBeNull=!!expectedParam.elementMayBeNull;
  3597. if (expectedType===Array && typeof (param) !=="undefined" && param !==null &&
  3598. (expectedElementType || !elementMayBeNull)) {
  3599. var expectedElementInteger=!!expectedParam.elementInteger, expectedElementDomElement=!!expectedParam.elementDomElement;
  3600. for (var i=0; i < param.length; i++) {
  3601. var elem=param[i];
  3602. e=Function._validateParameterType(elem, expectedElementType, expectedElementInteger, expectedElementDomElement, elementMayBeNull, paramName+"["+i+"]");
  3603. if (e) {
  3604. e.popStackFrame();
  3605. return e;
  3606. }
  3607. }
  3608. }
  3609. return null;
  3610. };
  3611. }
  3612. if (!Function._validateParameterType) {
  3613. Function._validateParameterType=function (param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
  3614. var e, i;
  3615. if (typeof (param)==="undefined") {
  3616. if (mayBeNull) {
  3617. return null;
  3618. }
  3619. else {
  3620. e=OfficeExt.MsAjaxError.argumentUndefined(paramName);
  3621. e.popStackFrame();
  3622. return e;
  3623. }
  3624. }
  3625. if (param===null) {
  3626. if (mayBeNull) {
  3627. return null;
  3628. }
  3629. else {
  3630. e=OfficeExt.MsAjaxError.argumentNull(paramName);
  3631. e.popStackFrame();
  3632. return e;
  3633. }
  3634. }
  3635. if (expectedType && !OfficeExt.MsAjaxTypeHelper.isInstanceOfType(expectedType, param)) {
  3636. e=OfficeExt.MsAjaxError.argumentType(paramName, typeof (param), expectedType);
  3637. e.popStackFrame();
  3638. return e;
  3639. }
  3640. return null;
  3641. };
  3642. }
  3643. if (!window.Type) {
  3644. window.Type=Function;
  3645. }
  3646. if (!Type.registerNamespace) {
  3647. Type.registerNamespace=function (ns) {
  3648. var namespaceParts=ns.split('.');
  3649. var currentNamespace=window;
  3650. for (var i=0; i < namespaceParts.length; i++) {
  3651. currentNamespace[namespaceParts[i]]=currentNamespace[namespaceParts[i]] || {};
  3652. currentNamespace=currentNamespace[namespaceParts[i]];
  3653. }
  3654. };
  3655. }
  3656. if (!Type.prototype.registerClass) {
  3657. Type.prototype.registerClass=function (cls) { cls={}; };
  3658. }
  3659. if (typeof (Sys)==="undefined") {
  3660. Type.registerNamespace('Sys');
  3661. }
  3662. if (!Error.prototype.popStackFrame) {
  3663. Error.prototype.popStackFrame=function () {
  3664. if (arguments.length !==0)
  3665. throw MsAjaxError.parameterCount();
  3666. if (typeof (this.stack)==="undefined" || this.stack===null ||
  3667. typeof (this.fileName)==="undefined" || this.fileName===null ||
  3668. typeof (this.lineNumber)==="undefined" || this.lineNumber===null) {
  3669. return;
  3670. }
  3671. var stackFrames=this.stack.split("\n");
  3672. var currentFrame=stackFrames[0];
  3673. var pattern=this.fileName+":"+this.lineNumber;
  3674. while (typeof (currentFrame) !=="undefined" &&
  3675. currentFrame !==null &&
  3676. currentFrame.indexOf(pattern)===-1) {
  3677. stackFrames.shift();
  3678. currentFrame=stackFrames[0];
  3679. }
  3680. var nextFrame=stackFrames[1];
  3681. if (typeof (nextFrame)==="undefined" || nextFrame===null) {
  3682. return;
  3683. }
  3684. var nextFrameParts=nextFrame.match(/@(.*):(\d+)$/);
  3685. if (typeof (nextFrameParts)==="undefined" || nextFrameParts===null) {
  3686. return;
  3687. }
  3688. this.fileName=nextFrameParts[1];
  3689. this.lineNumber=parseInt(nextFrameParts[2]);
  3690. stackFrames.shift();
  3691. this.stack=stackFrames.join("\n");
  3692. };
  3693. }
  3694. OsfMsAjaxFactory.msAjaxError=MsAjaxError;
  3695. OsfMsAjaxFactory.msAjaxString=MsAjaxString;
  3696. OsfMsAjaxFactory.msAjaxDebug=MsAjaxDebug;
  3697. }
  3698. })(OfficeExt || (OfficeExt={}));
  3699. OSF.OUtil.setNamespace("Microsoft", window);
  3700. OSF.OUtil.setNamespace("Office", Microsoft);
  3701. OSF.OUtil.setNamespace("Common", Microsoft.Office);
  3702. OSF.SerializerVersion={
  3703. MsAjax: 0,
  3704. Browser: 1
  3705. };
  3706. var OfficeExt;
  3707. (function (OfficeExt) {
  3708. function appSpecificCheckOriginFunction(url, eventObj, messageObj, checkOriginFunction) {
  3709. return true;
  3710. }
  3711. ;
  3712. OfficeExt.appSpecificCheckOrigin=appSpecificCheckOriginFunction;
  3713. })(OfficeExt || (OfficeExt={}));
  3714. Microsoft.Office.Common.InvokeType={ "async": 0,
  3715. "sync": 1,
  3716. "asyncRegisterEvent": 2,
  3717. "asyncUnregisterEvent": 3,
  3718. "syncRegisterEvent": 4,
  3719. "syncUnregisterEvent": 5
  3720. };
  3721. Microsoft.Office.Common.InvokeResultCode={
  3722. "noError": 0,
  3723. "errorInRequest": -1,
  3724. "errorHandlingRequest": -2,
  3725. "errorInResponse": -3,
  3726. "errorHandlingResponse": -4,
  3727. "errorHandlingRequestAccessDenied": -5,
  3728. "errorHandlingMethodCallTimedout": -6
  3729. };
  3730. Microsoft.Office.Common.MessageType={ "request": 0,
  3731. "response": 1
  3732. };
  3733. Microsoft.Office.Common.ActionType={ "invoke": 0,
  3734. "registerEvent": 1,
  3735. "unregisterEvent": 2 };
  3736. Microsoft.Office.Common.ResponseType={ "forCalling": 0,
  3737. "forEventing": 1
  3738. };
  3739. Microsoft.Office.Common.MethodObject=function Microsoft_Office_Common_MethodObject(method, invokeType, blockingOthers) {
  3740. this._method=method;
  3741. this._invokeType=invokeType;
  3742. this._blockingOthers=blockingOthers;
  3743. };
  3744. Microsoft.Office.Common.MethodObject.prototype={
  3745. getMethod: function Microsoft_Office_Common_MethodObject$getMethod() {
  3746. return this._method;
  3747. },
  3748. getInvokeType: function Microsoft_Office_Common_MethodObject$getInvokeType() {
  3749. return this._invokeType;
  3750. },
  3751. getBlockingFlag: function Microsoft_Office_Common_MethodObject$getBlockingFlag() {
  3752. return this._blockingOthers;
  3753. }
  3754. };
  3755. Microsoft.Office.Common.EventMethodObject=function Microsoft_Office_Common_EventMethodObject(registerMethodObject, unregisterMethodObject) {
  3756. this._registerMethodObject=registerMethodObject;
  3757. this._unregisterMethodObject=unregisterMethodObject;
  3758. };
  3759. Microsoft.Office.Common.EventMethodObject.prototype={
  3760. getRegisterMethodObject: function Microsoft_Office_Common_EventMethodObject$getRegisterMethodObject() {
  3761. return this._registerMethodObject;
  3762. },
  3763. getUnregisterMethodObject: function Microsoft_Office_Common_EventMethodObject$getUnregisterMethodObject() {
  3764. return this._unregisterMethodObject;
  3765. }
  3766. };
  3767. Microsoft.Office.Common.ServiceEndPoint=function Microsoft_Office_Common_ServiceEndPoint(serviceEndPointId) {
  3768. var e=Function._validateParams(arguments, [
  3769. { name: "serviceEndPointId", type: String, mayBeNull: false }
  3770. ]);
  3771. if (e)
  3772. throw e;
  3773. this._methodObjectList={};
  3774. this._eventHandlerProxyList={};
  3775. this._Id=serviceEndPointId;
  3776. this._conversations={};
  3777. this._policyManager=null;
  3778. this._appDomains={};
  3779. this._onHandleRequestError=null;
  3780. };
  3781. Microsoft.Office.Common.ServiceEndPoint.prototype={
  3782. registerMethod: function Microsoft_Office_Common_ServiceEndPoint$registerMethod(methodName, method, invokeType, blockingOthers) {
  3783. var e=Function._validateParams(arguments, [{ name: "methodName", type: String, mayBeNull: false },
  3784. { name: "method", type: Function, mayBeNull: false },
  3785. { name: "invokeType", type: Number, mayBeNull: false },
  3786. { name: "blockingOthers", type: Boolean, mayBeNull: false }
  3787. ]);
  3788. if (e)
  3789. throw e;
  3790. if (invokeType !==Microsoft.Office.Common.InvokeType.async
  3791. && invokeType !==Microsoft.Office.Common.InvokeType.sync) {
  3792. throw OsfMsAjaxFactory.msAjaxError.argument("invokeType");
  3793. }
  3794. var methodObject=new Microsoft.Office.Common.MethodObject(method, invokeType, blockingOthers);
  3795. this._methodObjectList[methodName]=methodObject;
  3796. },
  3797. unregisterMethod: function Microsoft_Office_Common_ServiceEndPoint$unregisterMethod(methodName) {
  3798. var e=Function._validateParams(arguments, [
  3799. { name: "methodName", type: String, mayBeNull: false }
  3800. ]);
  3801. if (e)
  3802. throw e;
  3803. delete this._methodObjectList[methodName];
  3804. },
  3805. registerEvent: function Microsoft_Office_Common_ServiceEndPoint$registerEvent(eventName, registerMethod, unregisterMethod) {
  3806. var e=Function._validateParams(arguments, [{ name: "eventName", type: String, mayBeNull: false },
  3807. { name: "registerMethod", type: Function, mayBeNull: false },
  3808. { name: "unregisterMethod", type: Function, mayBeNull: false }
  3809. ]);
  3810. if (e)
  3811. throw e;
  3812. var methodObject=new Microsoft.Office.Common.EventMethodObject(new Microsoft.Office.Common.MethodObject(registerMethod, Microsoft.Office.Common.InvokeType.syncRegisterEvent, false), new Microsoft.Office.Common.MethodObject(unregisterMethod, Microsoft.Office.Common.InvokeType.syncUnregisterEvent, false));
  3813. this._methodObjectList[eventName]=methodObject;
  3814. },
  3815. registerEventEx: function Microsoft_Office_Common_ServiceEndPoint$registerEventEx(eventName, registerMethod, registerMethodInvokeType, unregisterMethod, unregisterMethodInvokeType) {
  3816. var e=Function._validateParams(arguments, [{ name: "eventName", type: String, mayBeNull: false },
  3817. { name: "registerMethod", type: Function, mayBeNull: false },
  3818. { name: "registerMethodInvokeType", type: Number, mayBeNull: false },
  3819. { name: "unregisterMethod", type: Function, mayBeNull: false },
  3820. { name: "unregisterMethodInvokeType", type: Number, mayBeNull: false }
  3821. ]);
  3822. if (e)
  3823. throw e;
  3824. var methodObject=new Microsoft.Office.Common.EventMethodObject(new Microsoft.Office.Common.MethodObject(registerMethod, registerMethodInvokeType, false), new Microsoft.Office.Common.MethodObject(unregisterMethod, unregisterMethodInvokeType, false));
  3825. this._methodObjectList[eventName]=methodObject;
  3826. },
  3827. unregisterEvent: function (eventName) {
  3828. var e=Function._validateParams(arguments, [
  3829. { name: "eventName", type: String, mayBeNull: false }
  3830. ]);
  3831. if (e)
  3832. throw e;
  3833. this.unregisterMethod(eventName);
  3834. },
  3835. registerConversation: function Microsoft_Office_Common_ServiceEndPoint$registerConversation(conversationId, conversationUrl, appDomains, serializerVersion) {
  3836. var e=Function._validateParams(arguments, [
  3837. { name: "conversationId", type: String, mayBeNull: false },
  3838. { name: "conversationUrl", type: String, mayBeNull: false, optional: true },
  3839. { name: "appDomains", type: Object, mayBeNull: true, optional: true },
  3840. { name: "serializerVersion", type: Number, mayBeNull: true, optional: true }
  3841. ]);
  3842. if (e)
  3843. throw e;
  3844. ;
  3845. if (appDomains) {
  3846. if (!(appDomains instanceof Array)) {
  3847. throw OsfMsAjaxFactory.msAjaxError.argument("appDomains");
  3848. }
  3849. this._appDomains[conversationId]=appDomains;
  3850. }
  3851. this._conversations[conversationId]={ url: conversationUrl, serializerVersion: serializerVersion };
  3852. },
  3853. unregisterConversation: function Microsoft_Office_Common_ServiceEndPoint$unregisterConversation(conversationId) {
  3854. var e=Function._validateParams(arguments, [
  3855. { name: "conversationId", type: String, mayBeNull: false }
  3856. ]);
  3857. if (e)
  3858. throw e;
  3859. delete this._conversations[conversationId];
  3860. },
  3861. setPolicyManager: function Microsoft_Office_Common_ServiceEndPoint$setPolicyManager(policyManager) {
  3862. var e=Function._validateParams(arguments, [
  3863. { name: "policyManager", type: Object, mayBeNull: false }
  3864. ]);
  3865. if (e)
  3866. throw e;
  3867. if (!policyManager.checkPermission) {
  3868. throw OsfMsAjaxFactory.msAjaxError.argument("policyManager");
  3869. }
  3870. this._policyManager=policyManager;
  3871. },
  3872. getPolicyManager: function Microsoft_Office_Common_ServiceEndPoint$getPolicyManager() {
  3873. return this._policyManager;
  3874. },
  3875. dispose: function Microsoft_Office_Common_ServiceEndPoint$dispose() {
  3876. this._methodObjectList=null;
  3877. this._eventHandlerProxyList=null;
  3878. this._Id=null;
  3879. this._conversations=null;
  3880. this._policyManager=null;
  3881. this._appDomains=null;
  3882. this._onHandleRequestError=null;
  3883. }
  3884. };
  3885. Microsoft.Office.Common.ClientEndPoint=function Microsoft_Office_Common_ClientEndPoint(conversationId, targetWindow, targetUrl, serializerVersion) {
  3886. var e=Function._validateParams(arguments, [
  3887. { name: "conversationId", type: String, mayBeNull: false },
  3888. { name: "targetWindow", mayBeNull: false },
  3889. { name: "targetUrl", type: String, mayBeNull: false },
  3890. { name: "serializerVersion", type: Number, mayBeNull: true, optional: true }
  3891. ]);
  3892. if (e)
  3893. throw e;
  3894. try {
  3895. if (!targetWindow.postMessage) {
  3896. throw OsfMsAjaxFactory.msAjaxError.argument("targetWindow");
  3897. }
  3898. }
  3899. catch (ex) {
  3900. if (!Object.prototype.hasOwnProperty.call(targetWindow, "postMessage")) {
  3901. throw OsfMsAjaxFactory.msAjaxError.argument("targetWindow");
  3902. }
  3903. }
  3904. this._conversationId=conversationId;
  3905. this._targetWindow=targetWindow;
  3906. this._targetUrl=targetUrl;
  3907. this._callingIndex=0;
  3908. this._callbackList={};
  3909. this._eventHandlerList={};
  3910. if (serializerVersion !=null) {
  3911. this._serializerVersion=serializerVersion;
  3912. }
  3913. else {
  3914. this._serializerVersion=OSF.SerializerVersion.Browser;
  3915. }
  3916. };
  3917. Microsoft.Office.Common.ClientEndPoint.prototype={
  3918. invoke: function Microsoft_Office_Common_ClientEndPoint$invoke(targetMethodName, callback, param) {
  3919. var e=Function._validateParams(arguments, [{ name: "targetMethodName", type: String, mayBeNull: false },
  3920. { name: "callback", type: Function, mayBeNull: true },
  3921. { name: "param", mayBeNull: true }
  3922. ]);
  3923. if (e)
  3924. throw e;
  3925. var correlationId=this._callingIndex++;
  3926. var now=new Date();
  3927. var callbackEntry={ "callback": callback, "createdOn": now.getTime() };
  3928. if (param && typeof param==="object" && typeof param.__timeout__==="number") {
  3929. callbackEntry.timeout=param.__timeout__;
  3930. delete param.__timeout__;
  3931. }
  3932. this._callbackList[correlationId]=callbackEntry;
  3933. try {
  3934. var callRequest=new Microsoft.Office.Common.Request(targetMethodName, Microsoft.Office.Common.ActionType.invoke, this._conversationId, correlationId, param);
  3935. var msg=Microsoft.Office.Common.MessagePackager.envelope(callRequest, this._serializerVersion);
  3936. this._targetWindow.postMessage(msg, this._targetUrl);
  3937. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  3938. }
  3939. catch (ex) {
  3940. try {
  3941. if (callback !==null)
  3942. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  3943. }
  3944. finally {
  3945. delete this._callbackList[correlationId];
  3946. }
  3947. }
  3948. },
  3949. registerForEvent: function Microsoft_Office_Common_ClientEndPoint$registerForEvent(targetEventName, eventHandler, callback, data) {
  3950. var e=Function._validateParams(arguments, [{ name: "targetEventName", type: String, mayBeNull: false },
  3951. { name: "eventHandler", type: Function, mayBeNull: false },
  3952. { name: "callback", type: Function, mayBeNull: true },
  3953. { name: "data", mayBeNull: true, optional: true }
  3954. ]);
  3955. if (e)
  3956. throw e;
  3957. var correlationId=this._callingIndex++;
  3958. var now=new Date();
  3959. this._callbackList[correlationId]={ "callback": callback, "createdOn": now.getTime() };
  3960. try {
  3961. var callRequest=new Microsoft.Office.Common.Request(targetEventName, Microsoft.Office.Common.ActionType.registerEvent, this._conversationId, correlationId, data);
  3962. var msg=Microsoft.Office.Common.MessagePackager.envelope(callRequest, this._serializerVersion);
  3963. this._targetWindow.postMessage(msg, this._targetUrl);
  3964. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  3965. this._eventHandlerList[targetEventName]=eventHandler;
  3966. }
  3967. catch (ex) {
  3968. try {
  3969. if (callback !==null) {
  3970. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  3971. }
  3972. }
  3973. finally {
  3974. delete this._callbackList[correlationId];
  3975. }
  3976. }
  3977. },
  3978. unregisterForEvent: function Microsoft_Office_Common_ClientEndPoint$unregisterForEvent(targetEventName, callback, data) {
  3979. var e=Function._validateParams(arguments, [{ name: "targetEventName", type: String, mayBeNull: false },
  3980. { name: "callback", type: Function, mayBeNull: true },
  3981. { name: "data", mayBeNull: true, optional: true }
  3982. ]);
  3983. if (e)
  3984. throw e;
  3985. var correlationId=this._callingIndex++;
  3986. var now=new Date();
  3987. this._callbackList[correlationId]={ "callback": callback, "createdOn": now.getTime() };
  3988. try {
  3989. var callRequest=new Microsoft.Office.Common.Request(targetEventName, Microsoft.Office.Common.ActionType.unregisterEvent, this._conversationId, correlationId, data);
  3990. var msg=Microsoft.Office.Common.MessagePackager.envelope(callRequest, this._serializerVersion);
  3991. this._targetWindow.postMessage(msg, this._targetUrl);
  3992. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  3993. }
  3994. catch (ex) {
  3995. try {
  3996. if (callback !==null) {
  3997. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  3998. }
  3999. }
  4000. finally {
  4001. delete this._callbackList[correlationId];
  4002. }
  4003. }
  4004. finally {
  4005. delete this._eventHandlerList[targetEventName];
  4006. }
  4007. }
  4008. };
  4009. Microsoft.Office.Common.XdmCommunicationManager=(function () {
  4010. var _invokerQueue=[];
  4011. var _lastMessageProcessTime=null;
  4012. var _messageProcessingTimer=null;
  4013. var _processInterval=10;
  4014. var _blockingFlag=false;
  4015. var _methodTimeoutTimer=null;
  4016. var _methodTimeoutProcessInterval=2000;
  4017. var _methodTimeoutDefault=65000;
  4018. var _methodTimeout=_methodTimeoutDefault;
  4019. var _serviceEndPoints={};
  4020. var _clientEndPoints={};
  4021. var _initialized=false;
  4022. function _lookupServiceEndPoint(conversationId) {
  4023. for (var id in _serviceEndPoints) {
  4024. if (_serviceEndPoints[id]._conversations[conversationId]) {
  4025. return _serviceEndPoints[id];
  4026. }
  4027. }
  4028. OsfMsAjaxFactory.msAjaxDebug.trace("Unknown conversation Id.");
  4029. throw OsfMsAjaxFactory.msAjaxError.argument("conversationId");
  4030. }
  4031. ;
  4032. function _lookupClientEndPoint(conversationId) {
  4033. var clientEndPoint=_clientEndPoints[conversationId];
  4034. if (!clientEndPoint) {
  4035. OsfMsAjaxFactory.msAjaxDebug.trace("Unknown conversation Id.");
  4036. }
  4037. return clientEndPoint;
  4038. }
  4039. ;
  4040. function _lookupMethodObject(serviceEndPoint, messageObject) {
  4041. var methodOrEventMethodObject=serviceEndPoint._methodObjectList[messageObject._actionName];
  4042. if (!methodOrEventMethodObject) {
  4043. OsfMsAjaxFactory.msAjaxDebug.trace("The specified method is not registered on service endpoint:"+messageObject._actionName);
  4044. throw OsfMsAjaxFactory.msAjaxError.argument("messageObject");
  4045. }
  4046. var methodObject=null;
  4047. if (messageObject._actionType===Microsoft.Office.Common.ActionType.invoke) {
  4048. methodObject=methodOrEventMethodObject;
  4049. }
  4050. else if (messageObject._actionType===Microsoft.Office.Common.ActionType.registerEvent) {
  4051. methodObject=methodOrEventMethodObject.getRegisterMethodObject();
  4052. }
  4053. else {
  4054. methodObject=methodOrEventMethodObject.getUnregisterMethodObject();
  4055. }
  4056. return methodObject;
  4057. }
  4058. ;
  4059. function _enqueInvoker(invoker) {
  4060. _invokerQueue.push(invoker);
  4061. }
  4062. ;
  4063. function _dequeInvoker() {
  4064. if (_messageProcessingTimer !==null) {
  4065. if (!_blockingFlag) {
  4066. if (_invokerQueue.length > 0) {
  4067. var invoker=_invokerQueue.shift();
  4068. _executeCommand(invoker);
  4069. }
  4070. else {
  4071. clearInterval(_messageProcessingTimer);
  4072. _messageProcessingTimer=null;
  4073. }
  4074. }
  4075. }
  4076. else {
  4077. OsfMsAjaxFactory.msAjaxDebug.trace("channel is not ready.");
  4078. }
  4079. }
  4080. ;
  4081. function _executeCommand(invoker) {
  4082. _blockingFlag=invoker.getInvokeBlockingFlag();
  4083. invoker.invoke();
  4084. _lastMessageProcessTime=(new Date()).getTime();
  4085. }
  4086. ;
  4087. function _checkMethodTimeout() {
  4088. if (_methodTimeoutTimer) {
  4089. var clientEndPoint;
  4090. var methodCallsNotTimedout=0;
  4091. var now=new Date();
  4092. var timeoutValue;
  4093. for (var conversationId in _clientEndPoints) {
  4094. clientEndPoint=_clientEndPoints[conversationId];
  4095. for (var correlationId in clientEndPoint._callbackList) {
  4096. var callbackEntry=clientEndPoint._callbackList[correlationId];
  4097. timeoutValue=callbackEntry.timeout ? callbackEntry.timeout : _methodTimeout;
  4098. if (timeoutValue >=0 && Math.abs(now.getTime() - callbackEntry.createdOn) >=timeoutValue) {
  4099. try {
  4100. if (callbackEntry.callback) {
  4101. callbackEntry.callback(Microsoft.Office.Common.InvokeResultCode.errorHandlingMethodCallTimedout, null);
  4102. }
  4103. }
  4104. finally {
  4105. delete clientEndPoint._callbackList[correlationId];
  4106. }
  4107. }
  4108. else {
  4109. methodCallsNotTimedout++;
  4110. }
  4111. ;
  4112. }
  4113. }
  4114. if (methodCallsNotTimedout===0) {
  4115. clearInterval(_methodTimeoutTimer);
  4116. _methodTimeoutTimer=null;
  4117. }
  4118. }
  4119. else {
  4120. OsfMsAjaxFactory.msAjaxDebug.trace("channel is not ready.");
  4121. }
  4122. }
  4123. ;
  4124. function _postCallbackHandler() {
  4125. _blockingFlag=false;
  4126. }
  4127. ;
  4128. function _registerListener(listener) {
  4129. if (window.addEventListener) {
  4130. window.addEventListener("message", listener, false);
  4131. }
  4132. else if ((navigator.userAgent.indexOf("MSIE") > -1) && window.attachEvent) {
  4133. window.attachEvent("onmessage", listener);
  4134. }
  4135. else {
  4136. OsfMsAjaxFactory.msAjaxDebug.trace("Browser doesn't support the required API.");
  4137. throw OsfMsAjaxFactory.msAjaxError.argument("Browser");
  4138. }
  4139. }
  4140. ;
  4141. function _checkOrigin(url, origin) {
  4142. var res=false;
  4143. if (url===true) {
  4144. return true;
  4145. }
  4146. if (!url || !origin || !url.length || !origin.length) {
  4147. return res;
  4148. }
  4149. var url_parser, org_parser;
  4150. url_parser=document.createElement('a');
  4151. org_parser=document.createElement('a');
  4152. url_parser.href=url;
  4153. org_parser.href=origin;
  4154. res=_urlCompare(url_parser, org_parser);
  4155. delete url_parser, org_parser;
  4156. return res;
  4157. }
  4158. function _checkOriginWithAppDomains(allowed_domains, origin) {
  4159. var res=false;
  4160. if (!origin || !origin.length || !(allowed_domains) || !(allowed_domains instanceof Array) || !allowed_domains.length) {
  4161. return res;
  4162. }
  4163. var org_parser=document.createElement('a');
  4164. var app_domain_parser=document.createElement('a');
  4165. org_parser.href=origin;
  4166. for (var i=0; i < allowed_domains.length && !res; i++) {
  4167. if (allowed_domains[i].indexOf("://") !==-1) {
  4168. app_domain_parser.href=allowed_domains[i];
  4169. res=_urlCompare(org_parser, app_domain_parser);
  4170. }
  4171. }
  4172. delete org_parser, app_domain_parser;
  4173. return res;
  4174. }
  4175. function _urlCompare(url_parser1, url_parser2) {
  4176. return ((url_parser1.hostname==url_parser2.hostname) &&
  4177. (url_parser1.protocol==url_parser2.protocol) &&
  4178. (url_parser1.port==url_parser2.port));
  4179. }
  4180. function _receive(e) {
  4181. if (!OSF) {
  4182. return;
  4183. }
  4184. if (e.data !='') {
  4185. var messageObject;
  4186. var serializerVersion=OSF.SerializerVersion.Browser;
  4187. var serializedMessage=e.data;
  4188. try {
  4189. messageObject=Microsoft.Office.Common.MessagePackager.unenvelope(serializedMessage, OSF.SerializerVersion.Browser);
  4190. serializerVersion=messageObject._serializerVersion !=null ? messageObject._serializerVersion : serializerVersion;
  4191. }
  4192. catch (ex) {
  4193. return;
  4194. }
  4195. if (messageObject._messageType===Microsoft.Office.Common.MessageType.request) {
  4196. var requesterUrl=(e.origin==null || e.origin=="null") ? messageObject._origin : e.origin;
  4197. try {
  4198. var serviceEndPoint=_lookupServiceEndPoint(messageObject._conversationId);
  4199. ;
  4200. var conversation=serviceEndPoint._conversations[messageObject._conversationId];
  4201. serializerVersion=conversation.serializerVersion !=null ? conversation.serializerVersion : serializerVersion;
  4202. ;
  4203. if (!_checkOrigin(conversation.url, e.origin) && !_checkOriginWithAppDomains(serviceEndPoint._appDomains[messageObject._conversationId], e.origin)) {
  4204. throw "Failed origin check";
  4205. }
  4206. var policyManager=serviceEndPoint.getPolicyManager();
  4207. if (policyManager && !policyManager.checkPermission(messageObject._conversationId, messageObject._actionName, messageObject._data)) {
  4208. throw "Access Denied";
  4209. }
  4210. var methodObject=_lookupMethodObject(serviceEndPoint, messageObject);
  4211. var invokeCompleteCallback=new Microsoft.Office.Common.InvokeCompleteCallback(e.source, requesterUrl, messageObject._actionName, messageObject._conversationId, messageObject._correlationId, _postCallbackHandler, serializerVersion);
  4212. var invoker=new Microsoft.Office.Common.Invoker(methodObject, messageObject._data, invokeCompleteCallback, serviceEndPoint._eventHandlerProxyList, messageObject._conversationId, messageObject._actionName, serializerVersion);
  4213. var shouldEnque=true;
  4214. if (_messageProcessingTimer==null) {
  4215. if ((_lastMessageProcessTime==null || (new Date()).getTime() - _lastMessageProcessTime > _processInterval) && !_blockingFlag) {
  4216. _executeCommand(invoker);
  4217. shouldEnque=false;
  4218. }
  4219. else {
  4220. _messageProcessingTimer=setInterval(_dequeInvoker, _processInterval);
  4221. }
  4222. }
  4223. if (shouldEnque) {
  4224. _enqueInvoker(invoker);
  4225. }
  4226. }
  4227. catch (ex) {
  4228. if (serviceEndPoint && serviceEndPoint._onHandleRequestError) {
  4229. serviceEndPoint._onHandleRequestError(messageObject, ex);
  4230. }
  4231. var errorCode=Microsoft.Office.Common.InvokeResultCode.errorHandlingRequest;
  4232. if (ex=="Access Denied") {
  4233. errorCode=Microsoft.Office.Common.InvokeResultCode.errorHandlingRequestAccessDenied;
  4234. }
  4235. var callResponse=new Microsoft.Office.Common.Response(messageObject._actionName, messageObject._conversationId, messageObject._correlationId, errorCode, Microsoft.Office.Common.ResponseType.forCalling, ex);
  4236. var envelopedResult=Microsoft.Office.Common.MessagePackager.envelope(callResponse, serializerVersion);
  4237. if (e.source && e.source.postMessage) {
  4238. e.source.postMessage(envelopedResult, requesterUrl);
  4239. }
  4240. }
  4241. }
  4242. else if (messageObject._messageType===Microsoft.Office.Common.MessageType.response) {
  4243. var clientEndPoint=_lookupClientEndPoint(messageObject._conversationId);
  4244. if (!clientEndPoint) {
  4245. return;
  4246. }
  4247. clientEndPoint._serializerVersion=serializerVersion;
  4248. ;
  4249. if (!_checkOrigin(clientEndPoint._targetUrl, e.origin)) {
  4250. throw "Failed orgin check";
  4251. }
  4252. if (messageObject._responseType===Microsoft.Office.Common.ResponseType.forCalling) {
  4253. var callbackEntry=clientEndPoint._callbackList[messageObject._correlationId];
  4254. if (callbackEntry) {
  4255. try {
  4256. if (callbackEntry.callback)
  4257. callbackEntry.callback(messageObject._errorCode, messageObject._data);
  4258. }
  4259. finally {
  4260. delete clientEndPoint._callbackList[messageObject._correlationId];
  4261. }
  4262. }
  4263. }
  4264. else {
  4265. var eventhandler=clientEndPoint._eventHandlerList[messageObject._actionName];
  4266. if (eventhandler !==undefined && eventhandler !==null) {
  4267. eventhandler(messageObject._data);
  4268. }
  4269. }
  4270. }
  4271. else {
  4272. return;
  4273. }
  4274. }
  4275. }
  4276. ;
  4277. function _initialize() {
  4278. if (!_initialized) {
  4279. _registerListener(_receive);
  4280. _initialized=true;
  4281. }
  4282. }
  4283. ;
  4284. return {
  4285. connect: function Microsoft_Office_Common_XdmCommunicationManager$connect(conversationId, targetWindow, targetUrl, serializerVersion) {
  4286. var clientEndPoint=_clientEndPoints[conversationId];
  4287. if (!clientEndPoint) {
  4288. _initialize();
  4289. clientEndPoint=new Microsoft.Office.Common.ClientEndPoint(conversationId, targetWindow, targetUrl, serializerVersion);
  4290. _clientEndPoints[conversationId]=clientEndPoint;
  4291. }
  4292. return clientEndPoint;
  4293. },
  4294. getClientEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$getClientEndPoint(conversationId) {
  4295. var e=Function._validateParams(arguments, [
  4296. { name: "conversationId", type: String, mayBeNull: false }
  4297. ]);
  4298. if (e)
  4299. throw e;
  4300. return _clientEndPoints[conversationId];
  4301. },
  4302. createServiceEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$createServiceEndPoint(serviceEndPointId) {
  4303. _initialize();
  4304. var serviceEndPoint=new Microsoft.Office.Common.ServiceEndPoint(serviceEndPointId);
  4305. _serviceEndPoints[serviceEndPointId]=serviceEndPoint;
  4306. return serviceEndPoint;
  4307. },
  4308. getServiceEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$getServiceEndPoint(serviceEndPointId) {
  4309. var e=Function._validateParams(arguments, [
  4310. { name: "serviceEndPointId", type: String, mayBeNull: false }
  4311. ]);
  4312. if (e)
  4313. throw e;
  4314. return _serviceEndPoints[serviceEndPointId];
  4315. },
  4316. deleteClientEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$deleteClientEndPoint(conversationId) {
  4317. var e=Function._validateParams(arguments, [
  4318. { name: "conversationId", type: String, mayBeNull: false }
  4319. ]);
  4320. if (e)
  4321. throw e;
  4322. delete _clientEndPoints[conversationId];
  4323. },
  4324. deleteServiceEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$deleteServiceEndPoint(serviceEndPointId) {
  4325. var e=Function._validateParams(arguments, [
  4326. { name: "serviceEndPointId", type: String, mayBeNull: false }
  4327. ]);
  4328. if (e)
  4329. throw e;
  4330. delete _serviceEndPoints[serviceEndPointId];
  4331. },
  4332. checkUrlWithAppDomains: function Microsoft_Office_Common_XdmCommunicationManager$_checkUrlWithAppDomains(appDomains, origin) {
  4333. return _checkOriginWithAppDomains(appDomains, origin);
  4334. },
  4335. _setMethodTimeout: function Microsoft_Office_Common_XdmCommunicationManager$_setMethodTimeout(methodTimeout) {
  4336. var e=Function._validateParams(arguments, [
  4337. { name: "methodTimeout", type: Number, mayBeNull: false }
  4338. ]);
  4339. if (e)
  4340. throw e;
  4341. _methodTimeout=(methodTimeout <=0) ? _methodTimeoutDefault : methodTimeout;
  4342. },
  4343. _startMethodTimeoutTimer: function Microsoft_Office_Common_XdmCommunicationManager$_startMethodTimeoutTimer() {
  4344. if (!_methodTimeoutTimer) {
  4345. _methodTimeoutTimer=setInterval(_checkMethodTimeout, _methodTimeoutProcessInterval);
  4346. }
  4347. }
  4348. };
  4349. })();
  4350. Microsoft.Office.Common.Message=function Microsoft_Office_Common_Message(messageType, actionName, conversationId, correlationId, data) {
  4351. var e=Function._validateParams(arguments, [{ name: "messageType", type: Number, mayBeNull: false },
  4352. { name: "actionName", type: String, mayBeNull: false },
  4353. { name: "conversationId", type: String, mayBeNull: false },
  4354. { name: "correlationId", mayBeNull: false },
  4355. { name: "data", mayBeNull: true, optional: true }
  4356. ]);
  4357. if (e)
  4358. throw e;
  4359. this._messageType=messageType;
  4360. this._actionName=actionName;
  4361. this._conversationId=conversationId;
  4362. this._correlationId=correlationId;
  4363. this._origin=window.location.href;
  4364. if (typeof data=="undefined") {
  4365. this._data=null;
  4366. }
  4367. else {
  4368. this._data=data;
  4369. }
  4370. };
  4371. Microsoft.Office.Common.Message.prototype={
  4372. getActionName: function Microsoft_Office_Common_Message$getActionName() {
  4373. return this._actionName;
  4374. },
  4375. getConversationId: function Microsoft_Office_Common_Message$getConversationId() {
  4376. return this._conversationId;
  4377. },
  4378. getCorrelationId: function Microsoft_Office_Common_Message$getCorrelationId() {
  4379. return this._correlationId;
  4380. },
  4381. getOrigin: function Microsoft_Office_Common_Message$getOrigin() {
  4382. return this._origin;
  4383. },
  4384. getData: function Microsoft_Office_Common_Message$getData() {
  4385. return this._data;
  4386. },
  4387. getMessageType: function Microsoft_Office_Common_Message$getMessageType() {
  4388. return this._messageType;
  4389. }
  4390. };
  4391. Microsoft.Office.Common.Request=function Microsoft_Office_Common_Request(actionName, actionType, conversationId, correlationId, data) {
  4392. Microsoft.Office.Common.Request.uber.constructor.call(this, Microsoft.Office.Common.MessageType.request, actionName, conversationId, correlationId, data);
  4393. this._actionType=actionType;
  4394. };
  4395. OSF.OUtil.extend(Microsoft.Office.Common.Request, Microsoft.Office.Common.Message);
  4396. Microsoft.Office.Common.Request.prototype.getActionType=function Microsoft_Office_Common_Request$getActionType() {
  4397. return this._actionType;
  4398. };
  4399. Microsoft.Office.Common.Response=function Microsoft_Office_Common_Response(actionName, conversationId, correlationId, errorCode, responseType, data) {
  4400. Microsoft.Office.Common.Response.uber.constructor.call(this, Microsoft.Office.Common.MessageType.response, actionName, conversationId, correlationId, data);
  4401. this._errorCode=errorCode;
  4402. this._responseType=responseType;
  4403. };
  4404. OSF.OUtil.extend(Microsoft.Office.Common.Response, Microsoft.Office.Common.Message);
  4405. Microsoft.Office.Common.Response.prototype.getErrorCode=function Microsoft_Office_Common_Response$getErrorCode() {
  4406. return this._errorCode;
  4407. };
  4408. Microsoft.Office.Common.Response.prototype.getResponseType=function Microsoft_Office_Common_Response$getResponseType() {
  4409. return this._responseType;
  4410. };
  4411. Microsoft.Office.Common.MessagePackager={
  4412. envelope: function Microsoft_Office_Common_MessagePackager$envelope(messageObject, serializerVersion) {
  4413. if (typeof (messageObject)==="object") {
  4414. messageObject._serializerVersion=OSF.SerializerVersion.Browser;
  4415. }
  4416. return JSON.stringify(messageObject);
  4417. },
  4418. unenvelope: function Microsoft_Office_Common_MessagePackager$unenvelope(messageObject, serializerVersion) {
  4419. return JSON.parse(messageObject);
  4420. }
  4421. };
  4422. Microsoft.Office.Common.ResponseSender=function Microsoft_Office_Common_ResponseSender(requesterWindow, requesterUrl, actionName, conversationId, correlationId, responseType, serializerVersion) {
  4423. var e=Function._validateParams(arguments, [{ name: "requesterWindow", mayBeNull: false },
  4424. { name: "requesterUrl", type: String, mayBeNull: false },
  4425. { name: "actionName", type: String, mayBeNull: false },
  4426. { name: "conversationId", type: String, mayBeNull: false },
  4427. { name: "correlationId", mayBeNull: false },
  4428. { name: "responsetype", type: Number, maybeNull: false },
  4429. { name: "serializerVersion", type: Number, maybeNull: true, optional: true }
  4430. ]);
  4431. if (e)
  4432. throw e;
  4433. this._requesterWindow=requesterWindow;
  4434. this._requesterUrl=requesterUrl;
  4435. this._actionName=actionName;
  4436. this._conversationId=conversationId;
  4437. this._correlationId=correlationId;
  4438. this._invokeResultCode=Microsoft.Office.Common.InvokeResultCode.noError;
  4439. this._responseType=responseType;
  4440. var me=this;
  4441. this._send=function (result) {
  4442. try {
  4443. var response=new Microsoft.Office.Common.Response(me._actionName, me._conversationId, me._correlationId, me._invokeResultCode, me._responseType, result);
  4444. var envelopedResult=Microsoft.Office.Common.MessagePackager.envelope(response, serializerVersion);
  4445. me._requesterWindow.postMessage(envelopedResult, me._requesterUrl);
  4446. ;
  4447. }
  4448. catch (ex) {
  4449. OsfMsAjaxFactory.msAjaxDebug.trace("ResponseSender._send error:"+ex.message);
  4450. }
  4451. };
  4452. };
  4453. Microsoft.Office.Common.ResponseSender.prototype={
  4454. getRequesterWindow: function Microsoft_Office_Common_ResponseSender$getRequesterWindow() {
  4455. return this._requesterWindow;
  4456. },
  4457. getRequesterUrl: function Microsoft_Office_Common_ResponseSender$getRequesterUrl() {
  4458. return this._requesterUrl;
  4459. },
  4460. getActionName: function Microsoft_Office_Common_ResponseSender$getActionName() {
  4461. return this._actionName;
  4462. },
  4463. getConversationId: function Microsoft_Office_Common_ResponseSender$getConversationId() {
  4464. return this._conversationId;
  4465. },
  4466. getCorrelationId: function Microsoft_Office_Common_ResponseSender$getCorrelationId() {
  4467. return this._correlationId;
  4468. },
  4469. getSend: function Microsoft_Office_Common_ResponseSender$getSend() {
  4470. return this._send;
  4471. },
  4472. setResultCode: function Microsoft_Office_Common_ResponseSender$setResultCode(resultCode) {
  4473. this._invokeResultCode=resultCode;
  4474. }
  4475. };
  4476. Microsoft.Office.Common.InvokeCompleteCallback=function Microsoft_Office_Common_InvokeCompleteCallback(requesterWindow, requesterUrl, actionName, conversationId, correlationId, postCallbackHandler, serializerVersion) {
  4477. Microsoft.Office.Common.InvokeCompleteCallback.uber.constructor.call(this, requesterWindow, requesterUrl, actionName, conversationId, correlationId, Microsoft.Office.Common.ResponseType.forCalling, serializerVersion);
  4478. this._postCallbackHandler=postCallbackHandler;
  4479. var me=this;
  4480. this._send=function (result, responseCode) {
  4481. if (responseCode !=undefined) {
  4482. me._invokeResultCode=responseCode;
  4483. }
  4484. try {
  4485. var response=new Microsoft.Office.Common.Response(me._actionName, me._conversationId, me._correlationId, me._invokeResultCode, me._responseType, result);
  4486. var envelopedResult=Microsoft.Office.Common.MessagePackager.envelope(response, serializerVersion);
  4487. me._requesterWindow.postMessage(envelopedResult, me._requesterUrl);
  4488. me._postCallbackHandler();
  4489. }
  4490. catch (ex) {
  4491. OsfMsAjaxFactory.msAjaxDebug.trace("InvokeCompleteCallback._send error:"+ex.message);
  4492. }
  4493. };
  4494. };
  4495. OSF.OUtil.extend(Microsoft.Office.Common.InvokeCompleteCallback, Microsoft.Office.Common.ResponseSender);
  4496. Microsoft.Office.Common.Invoker=function Microsoft_Office_Common_Invoker(methodObject, paramValue, invokeCompleteCallback, eventHandlerProxyList, conversationId, eventName, serializerVersion) {
  4497. var e=Function._validateParams(arguments, [
  4498. { name: "methodObject", mayBeNull: false },
  4499. { name: "paramValue", mayBeNull: true },
  4500. { name: "invokeCompleteCallback", mayBeNull: false },
  4501. { name: "eventHandlerProxyList", mayBeNull: true },
  4502. { name: "conversationId", type: String, mayBeNull: false },
  4503. { name: "eventName", type: String, mayBeNull: false },
  4504. { name: "serializerVersion", type: Number, mayBeNull: true, optional: true }
  4505. ]);
  4506. if (e)
  4507. throw e;
  4508. this._methodObject=methodObject;
  4509. this._param=paramValue;
  4510. this._invokeCompleteCallback=invokeCompleteCallback;
  4511. this._eventHandlerProxyList=eventHandlerProxyList;
  4512. this._conversationId=conversationId;
  4513. this._eventName=eventName;
  4514. this._serializerVersion=serializerVersion;
  4515. };
  4516. Microsoft.Office.Common.Invoker.prototype={
  4517. invoke: function Microsoft_Office_Common_Invoker$invoke() {
  4518. try {
  4519. var result;
  4520. switch (this._methodObject.getInvokeType()) {
  4521. case Microsoft.Office.Common.InvokeType.async:
  4522. this._methodObject.getMethod()(this._param, this._invokeCompleteCallback.getSend());
  4523. break;
  4524. case Microsoft.Office.Common.InvokeType.sync:
  4525. result=this._methodObject.getMethod()(this._param);
  4526. this._invokeCompleteCallback.getSend()(result);
  4527. break;
  4528. case Microsoft.Office.Common.InvokeType.syncRegisterEvent:
  4529. var eventHandlerProxy=this._createEventHandlerProxyObject(this._invokeCompleteCallback);
  4530. result=this._methodObject.getMethod()(eventHandlerProxy.getSend(), this._param);
  4531. this._eventHandlerProxyList[this._conversationId+this._eventName]=eventHandlerProxy.getSend();
  4532. this._invokeCompleteCallback.getSend()(result);
  4533. break;
  4534. case Microsoft.Office.Common.InvokeType.syncUnregisterEvent:
  4535. var eventHandler=this._eventHandlerProxyList[this._conversationId+this._eventName];
  4536. result=this._methodObject.getMethod()(eventHandler, this._param);
  4537. delete this._eventHandlerProxyList[this._conversationId+this._eventName];
  4538. this._invokeCompleteCallback.getSend()(result);
  4539. break;
  4540. case Microsoft.Office.Common.InvokeType.asyncRegisterEvent:
  4541. var eventHandlerProxyAsync=this._createEventHandlerProxyObject(this._invokeCompleteCallback);
  4542. this._methodObject.getMethod()(eventHandlerProxyAsync.getSend(), this._invokeCompleteCallback.getSend(), this._param);
  4543. this._eventHandlerProxyList[this._callerId+this._eventName]=eventHandlerProxyAsync.getSend();
  4544. break;
  4545. case Microsoft.Office.Common.InvokeType.asyncUnregisterEvent:
  4546. var eventHandlerAsync=this._eventHandlerProxyList[this._callerId+this._eventName];
  4547. this._methodObject.getMethod()(eventHandlerAsync, this._invokeCompleteCallback.getSend(), this._param);
  4548. delete this._eventHandlerProxyList[this._callerId+this._eventName];
  4549. break;
  4550. default:
  4551. break;
  4552. }
  4553. }
  4554. catch (ex) {
  4555. this._invokeCompleteCallback.setResultCode(Microsoft.Office.Common.InvokeResultCode.errorInResponse);
  4556. this._invokeCompleteCallback.getSend()(ex);
  4557. }
  4558. },
  4559. getInvokeBlockingFlag: function Microsoft_Office_Common_Invoker$getInvokeBlockingFlag() {
  4560. return this._methodObject.getBlockingFlag();
  4561. },
  4562. _createEventHandlerProxyObject: function Microsoft_Office_Common_Invoker$_createEventHandlerProxyObject(invokeCompleteObject) {
  4563. return new Microsoft.Office.Common.ResponseSender(invokeCompleteObject.getRequesterWindow(), invokeCompleteObject.getRequesterUrl(), invokeCompleteObject.getActionName(), invokeCompleteObject.getConversationId(), invokeCompleteObject.getCorrelationId(), Microsoft.Office.Common.ResponseType.forEventing, this._serializerVersion);
  4564. }
  4565. };
  4566. OSF.OUtil.setNamespace("WAC", OSF.DDA);
  4567. OSF.DDA.WAC.UniqueArguments={
  4568. Data: "Data",
  4569. Properties: "Properties",
  4570. BindingRequest: "DdaBindingsMethod",
  4571. BindingResponse: "Bindings",
  4572. SingleBindingResponse: "singleBindingResponse",
  4573. GetData: "DdaGetBindingData",
  4574. AddRowsColumns: "DdaAddRowsColumns",
  4575. SetData: "DdaSetBindingData",
  4576. ClearFormats: "DdaClearBindingFormats",
  4577. SetFormats: "DdaSetBindingFormats",
  4578. SettingsRequest: "DdaSettingsMethod",
  4579. BindingEventSource: "ddaBinding",
  4580. ArrayData: "ArrayData"
  4581. };
  4582. OSF.OUtil.setNamespace("Delegate", OSF.DDA.WAC);
  4583. OSF.DDA.WAC.Delegate.SpecialProcessor=function OSF_DDA_WAC_Delegate_SpecialProcessor() {
  4584. var complexTypes=[
  4585. OSF.DDA.WAC.UniqueArguments.SingleBindingResponse,
  4586. OSF.DDA.WAC.UniqueArguments.BindingRequest,
  4587. OSF.DDA.WAC.UniqueArguments.BindingResponse,
  4588. OSF.DDA.WAC.UniqueArguments.GetData,
  4589. OSF.DDA.WAC.UniqueArguments.AddRowsColumns,
  4590. OSF.DDA.WAC.UniqueArguments.SetData,
  4591. OSF.DDA.WAC.UniqueArguments.ClearFormats,
  4592. OSF.DDA.WAC.UniqueArguments.SetFormats,
  4593. OSF.DDA.WAC.UniqueArguments.SettingsRequest,
  4594. OSF.DDA.WAC.UniqueArguments.BindingEventSource
  4595. ];
  4596. var dynamicTypes={};
  4597. OSF.DDA.WAC.Delegate.SpecialProcessor.uber.constructor.call(this, complexTypes, dynamicTypes);
  4598. };
  4599. OSF.OUtil.extend(OSF.DDA.WAC.Delegate.SpecialProcessor, OSF.DDA.SpecialProcessor);
  4600. OSF.DDA.WAC.Delegate.ParameterMap=OSF.DDA.getDecoratedParameterMap(new OSF.DDA.WAC.Delegate.SpecialProcessor(), []);
  4601. OSF.OUtil.setNamespace("WAC", OSF.DDA);
  4602. OSF.OUtil.setNamespace("Delegate", OSF.DDA.WAC);
  4603. OSF.DDA.WAC.getDelegateMethods=function OSF_DDA_WAC_getDelegateMethods() {
  4604. var delegateMethods={};
  4605. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.WAC.Delegate.executeAsync;
  4606. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync]=OSF.DDA.WAC.Delegate.registerEventAsync;
  4607. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync]=OSF.DDA.WAC.Delegate.unregisterEventAsync;
  4608. delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog]=OSF.DDA.WAC.Delegate.openDialog;
  4609. delegateMethods[OSF.DDA.DispIdHost.Delegates.MessageParent]=OSF.DDA.WAC.Delegate.messageParent;
  4610. delegateMethods[OSF.DDA.DispIdHost.Delegates.SendMessage]=OSF.DDA.WAC.Delegate.sendMessage;
  4611. delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog]=OSF.DDA.WAC.Delegate.closeDialog;
  4612. return delegateMethods;
  4613. };
  4614. OSF.DDA.WAC.Delegate.version=1;
  4615. OSF.DDA.WAC.Delegate.executeAsync=function OSF_DDA_WAC_Delegate$executeAsync(args) {
  4616. if (!args.hostCallArgs) {
  4617. args.hostCallArgs={};
  4618. }
  4619. args.hostCallArgs["DdaMethod"]={
  4620. "ControlId": OSF._OfficeAppFactory.getId(),
  4621. "Version": OSF.DDA.WAC.Delegate.version,
  4622. "DispatchId": args.dispId
  4623. };
  4624. args.hostCallArgs["__timeout__"]=-1;
  4625. if (args.onCalling) {
  4626. args.onCalling();
  4627. }
  4628. var startTime=(new Date()).getTime();
  4629. OSF.getClientEndPoint().invoke("executeMethod", function OSF_DDA_WAC_Delegate$OMFacade$OnResponse(xdmStatus, payload) {
  4630. if (args.onReceiving) {
  4631. args.onReceiving();
  4632. }
  4633. var error;
  4634. if (xdmStatus==Microsoft.Office.Common.InvokeResultCode.noError) {
  4635. OSF.DDA.WAC.Delegate.version=payload["Version"];
  4636. error=payload["Error"];
  4637. }
  4638. else {
  4639. switch (xdmStatus) {
  4640. case Microsoft.Office.Common.InvokeResultCode.errorHandlingRequestAccessDenied:
  4641. error=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  4642. break;
  4643. default:
  4644. error=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4645. break;
  4646. }
  4647. }
  4648. if (args.onComplete) {
  4649. args.onComplete(error, payload);
  4650. }
  4651. if (OSF.AppTelemetry) {
  4652. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), error);
  4653. }
  4654. }, args.hostCallArgs);
  4655. };
  4656. OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent=function OSF_DDA_WAC_Delegate$GetOnAfterRegisterEvent(register, args) {
  4657. var startTime=(new Date()).getTime();
  4658. return function OSF_DDA_WAC_Delegate$OnAfterRegisterEvent(xdmStatus, payload) {
  4659. if (args.onReceiving) {
  4660. args.onReceiving();
  4661. }
  4662. var status;
  4663. if (xdmStatus !=Microsoft.Office.Common.InvokeResultCode.noError) {
  4664. switch (xdmStatus) {
  4665. case Microsoft.Office.Common.InvokeResultCode.errorHandlingRequestAccessDenied:
  4666. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  4667. break;
  4668. default:
  4669. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4670. break;
  4671. }
  4672. }
  4673. else {
  4674. if (payload) {
  4675. if (payload["Error"]) {
  4676. status=payload["Error"];
  4677. }
  4678. else {
  4679. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  4680. }
  4681. }
  4682. else {
  4683. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4684. }
  4685. }
  4686. if (args.onComplete) {
  4687. args.onComplete(status);
  4688. }
  4689. if (OSF.AppTelemetry) {
  4690. OSF.AppTelemetry.onRegisterDone(register, args.dispId, Math.abs((new Date()).getTime() - startTime), status);
  4691. }
  4692. };
  4693. };
  4694. OSF.DDA.WAC.Delegate.registerEventAsync=function OSF_DDA_WAC_Delegate$RegisterEventAsync(args) {
  4695. if (args.onCalling) {
  4696. args.onCalling();
  4697. }
  4698. OSF.getClientEndPoint().registerForEvent(OSF.DDA.getXdmEventName(args.targetId, args.eventType), function OSF_DDA_WACOMFacade$OnEvent(payload) {
  4699. if (args.onEvent) {
  4700. args.onEvent(payload);
  4701. }
  4702. if (OSF.AppTelemetry) {
  4703. OSF.AppTelemetry.onEventDone(args.dispId);
  4704. }
  4705. }, OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent(true, args), {
  4706. "controlId": OSF._OfficeAppFactory.getId(),
  4707. "eventDispId": args.dispId,
  4708. "targetId": args.targetId
  4709. });
  4710. };
  4711. OSF.DDA.WAC.Delegate.unregisterEventAsync=function OSF_DDA_WAC_Delegate$UnregisterEventAsync(args) {
  4712. if (args.onCalling) {
  4713. args.onCalling();
  4714. }
  4715. OSF.getClientEndPoint().unregisterForEvent(OSF.DDA.getXdmEventName(args.targetId, args.eventType), OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent(false, args), {
  4716. "controlId": OSF._OfficeAppFactory.getId(),
  4717. "eventDispId": args.dispId,
  4718. "targetId": args.targetId
  4719. });
  4720. };
  4721. OSF.OUtil.setNamespace("WebApp", OSF);
  4722. OSF.WebApp.AddHostInfoAndXdmInfo=function OSF_WebApp$AddHostInfoAndXdmInfo(url) {
  4723. if (OSF._OfficeAppFactory.getWindowLocationSearch && OSF._OfficeAppFactory.getWindowLocationHash) {
  4724. return url+OSF._OfficeAppFactory.getWindowLocationSearch()+OSF._OfficeAppFactory.getWindowLocationHash();
  4725. }
  4726. else {
  4727. return url;
  4728. }
  4729. };
  4730. OSF.WebApp._UpdateLinksForHostAndXdmInfo=function OSF_WebApp$_UpdateLinksForHostAndXdmInfo() {
  4731. var links=document.querySelectorAll("a[data-officejs-navigate]");
  4732. for (var i=0; i < links.length; i++) {
  4733. if (OSF.WebApp._isGoodUrl(links[i].href)) {
  4734. links[i].href=OSF.WebApp.AddHostInfoAndXdmInfo(links[i].href);
  4735. }
  4736. }
  4737. var forms=document.querySelectorAll("form[data-officejs-navigate]");
  4738. for (var i=0; i < forms.length; i++) {
  4739. var form=forms[i];
  4740. if (OSF.WebApp._isGoodUrl(form.action)) {
  4741. form.action=OSF.WebApp.AddHostInfoAndXdmInfo(form.action);
  4742. }
  4743. }
  4744. };
  4745. OSF.WebApp._isGoodUrl=function OSF_WebApp$_isGoodUrl(url) {
  4746. if (typeof url=='undefined')
  4747. return false;
  4748. url=url.trim();
  4749. var colonIndex=url.indexOf(':');
  4750. var protocol=colonIndex > 0 ? url.substr(0, colonIndex) : null;
  4751. var goodUrl=protocol !==null ? protocol.toLowerCase()==="http" || protocol.toLowerCase()==="https" : true;
  4752. goodUrl=goodUrl && url !="#" && url !="/" && url !="" && url !=OSF._OfficeAppFactory.getWebAppState().webAppUrl;
  4753. return goodUrl;
  4754. };
  4755. OSF.InitializationHelper=function OSF_InitializationHelper(hostInfo, webAppState, context, settings, hostFacade) {
  4756. this._hostInfo=hostInfo;
  4757. this._webAppState=webAppState;
  4758. this._context=context;
  4759. this._settings=settings;
  4760. this._hostFacade=hostFacade;
  4761. this._appContext={};
  4762. this._tabbableElements="a[href]:not([tabindex='-1']),"+"area[href]:not([tabindex='-1']),"+"button:not([disabled]):not([tabindex='-1']),"+"input:not([disabled]):not([tabindex='-1']),"+"select:not([disabled]):not([tabindex='-1']),"+"textarea:not([disabled]):not([tabindex='-1']),"+"*[tabindex]:not([tabindex='-1']),"+"*[contenteditable]:not([disabled]):not([tabindex='-1'])";
  4763. this._initializeSettings=function OSF_InitializationHelper$initializeSettings(appContext, refreshSupported) {
  4764. var settings;
  4765. var serializedSettings=appContext.get_settings();
  4766. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  4767. if (osfSessionStorage) {
  4768. var storageSettings=osfSessionStorage.getItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey());
  4769. if (storageSettings) {
  4770. serializedSettings=JSON.parse(storageSettings);
  4771. }
  4772. else {
  4773. storageSettings=JSON.stringify(serializedSettings);
  4774. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  4775. }
  4776. }
  4777. var deserializedSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  4778. if (refreshSupported) {
  4779. settings=new OSF.DDA.RefreshableSettings(deserializedSettings);
  4780. }
  4781. else {
  4782. settings=new OSF.DDA.Settings(deserializedSettings);
  4783. }
  4784. return settings;
  4785. };
  4786. var windowOpen=function OSF_InitializationHelper$windowOpen(windowObj) {
  4787. var proxy=window.open;
  4788. windowObj.open=function (strUrl, strWindowName, strWindowFeatures) {
  4789. var windowObject=null;
  4790. try {
  4791. windowObject=proxy(strUrl, strWindowName, strWindowFeatures);
  4792. }
  4793. catch (ex) {
  4794. if (OSF.AppTelemetry) {
  4795. OSF.AppTelemetry.logAppCommonMessage("Exception happens at windowOpen."+ex);
  4796. }
  4797. }
  4798. if (!windowObject) {
  4799. var params={
  4800. "strUrl": strUrl,
  4801. "strWindowName": strWindowName,
  4802. "strWindowFeatures": strWindowFeatures
  4803. };
  4804. OSF._OfficeAppFactory.getClientEndPoint().invoke("ContextActivationManager_openWindowInHost", null, params);
  4805. }
  4806. return windowObject;
  4807. };
  4808. };
  4809. windowOpen(window);
  4810. };
  4811. OSF.InitializationHelper.prototype.saveAndSetDialogInfo=function OSF_InitializationHelper$saveAndSetDialogInfo(hostInfoValue) {
  4812. var getAppIdFromWindowLocation=function OSF_InitializationHelper$getAppIdFromWindowLocation() {
  4813. var xdmInfoValue=OSF.OUtil.parseXdmInfo(true);
  4814. if (xdmInfoValue) {
  4815. var items=xdmInfoValue.split("|");
  4816. return items[1];
  4817. }
  4818. return null;
  4819. };
  4820. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  4821. if (osfSessionStorage) {
  4822. if (!hostInfoValue) {
  4823. hostInfoValue=OSF.OUtil.parseHostInfoFromWindowName(true, OSF._OfficeAppFactory.getWindowName());
  4824. }
  4825. if (hostInfoValue && hostInfoValue.indexOf("isDialog") > -1) {
  4826. var appId=getAppIdFromWindowLocation();
  4827. if (appId !=null) {
  4828. osfSessionStorage.setItem(appId+"IsDialog", "true");
  4829. }
  4830. }
  4831. this._hostInfo.isDialog=osfSessionStorage.getItem(OSF.OUtil.getXdmFieldValue(OSF.XdmFieldName.AppId, false)+"IsDialog") !=null ? true : false;
  4832. }
  4833. };
  4834. OSF.InitializationHelper.prototype.getAppContext=function OSF_InitializationHelper$getAppContext(wnd, gotAppContext) {
  4835. var me=this;
  4836. var getInvocationCallbackWebApp=function OSF_InitializationHelper_getAppContextAsync$getInvocationCallbackWebApp(errorCode, appContext) {
  4837. var settings;
  4838. if (appContext._appName===OSF.AppName.ExcelWebApp) {
  4839. var serializedSettings=appContext._settings;
  4840. settings={};
  4841. for (var index in serializedSettings) {
  4842. var setting=serializedSettings[index];
  4843. settings[setting[0]]=setting[1];
  4844. }
  4845. }
  4846. else {
  4847. settings=appContext._settings;
  4848. }
  4849. if (errorCode===0 && appContext._id !=undefined && appContext._appName !=undefined && appContext._appVersion !=undefined && appContext._appUILocale !=undefined && appContext._dataLocale !=undefined &&
  4850. appContext._docUrl !=undefined && appContext._clientMode !=undefined && appContext._settings !=undefined && appContext._reason !=undefined) {
  4851. me._appContext=appContext;
  4852. var appInstanceId=(appContext._appInstanceId ? appContext._appInstanceId : appContext._id);
  4853. var touchEnabled=false;
  4854. var commerceAllowed=true;
  4855. var minorVersion=0;
  4856. if (appContext._appMinorVersion !=undefined) {
  4857. minorVersion=appContext._appMinorVersion;
  4858. }
  4859. var requirementMatrix=undefined;
  4860. if (appContext._requirementMatrix !=undefined) {
  4861. requirementMatrix=appContext._requirementMatrix;
  4862. }
  4863. var returnedContext=new OSF.OfficeAppContext(appContext._id, appContext._appName, appContext._appVersion, appContext._appUILocale, appContext._dataLocale, appContext._docUrl, appContext._clientMode, settings, appContext._reason, appContext._osfControlType, appContext._eToken, appContext._correlationId, appInstanceId, touchEnabled, commerceAllowed, minorVersion, requirementMatrix, appContext._hostCustomMessage, appContext._hostFullVersion, appContext._clientWindowHeight, appContext._clientWindowWidth, appContext._addinName);
  4864. if (OSF.AppTelemetry) {
  4865. OSF.AppTelemetry.initialize(returnedContext);
  4866. }
  4867. gotAppContext(returnedContext);
  4868. }
  4869. else {
  4870. var errorMsg="Function ContextActivationManager_getAppContextAsync call failed. ErrorCode is "+errorCode+", exception: "+appContext;
  4871. if (OSF.AppTelemetry) {
  4872. OSF.AppTelemetry.logAppException(errorMsg);
  4873. }
  4874. throw errorMsg;
  4875. }
  4876. };
  4877. try {
  4878. if (this._hostInfo.isDialog && window.opener !=null) {
  4879. var appContext=OfficeExt.WACUtils.parseAppContextFromWindowName(false, OSF._OfficeAppFactory.getWindowName());
  4880. getInvocationCallbackWebApp(0, appContext);
  4881. }
  4882. else {
  4883. this._webAppState.clientEndPoint.invoke("ContextActivationManager_getAppContextAsync", getInvocationCallbackWebApp, this._webAppState.id);
  4884. }
  4885. }
  4886. catch (ex) {
  4887. if (OSF.AppTelemetry) {
  4888. OSF.AppTelemetry.logAppException("Exception thrown when trying to invoke getAppContextAsync. Exception:["+ex+"]");
  4889. }
  4890. throw ex;
  4891. }
  4892. };
  4893. OSF.InitializationHelper.prototype.setAgaveHostCommunication=function OSF_InitializationHelper$setAgaveHostCommunication() {
  4894. try {
  4895. var me=this;
  4896. var xdmInfoValue=OSF.OUtil.parseXdmInfoWithGivenFragment(false, OSF._OfficeAppFactory.getWindowLocationHash());
  4897. if (!xdmInfoValue && OSF._OfficeAppFactory.getWindowName) {
  4898. xdmInfoValue=OSF.OUtil.parseXdmInfoFromWindowName(false, OSF._OfficeAppFactory.getWindowName());
  4899. }
  4900. if (xdmInfoValue) {
  4901. var xdmItems=OSF.OUtil.getInfoItems(xdmInfoValue);
  4902. if (xdmItems !=undefined && xdmItems.length >=3) {
  4903. me._webAppState.conversationID=xdmItems[0];
  4904. me._webAppState.id=xdmItems[1];
  4905. me._webAppState.webAppUrl=xdmItems[2].indexOf(":") >=0 ? xdmItems[2] : decodeURIComponent(xdmItems[2]);
  4906. }
  4907. }
  4908. me._webAppState.wnd=window.opener !=null ? window.opener : window.parent;
  4909. var serializerVersion=OSF.OUtil.parseSerializerVersionWithGivenFragment(false, OSF._OfficeAppFactory.getWindowLocationHash());
  4910. if (isNaN(serializerVersion) && OSF._OfficeAppFactory.getWindowName) {
  4911. serializerVersion=OSF.OUtil.parseSerializerVersionFromWindowName(false, OSF._OfficeAppFactory.getWindowName());
  4912. }
  4913. me._webAppState.serializerVersion=serializerVersion;
  4914. me._webAppState.clientEndPoint=Microsoft.Office.Common.XdmCommunicationManager.connect(me._webAppState.conversationID, me._webAppState.wnd, me._webAppState.webAppUrl, me._webAppState.serializerVersion);
  4915. me._webAppState.serviceEndPoint=Microsoft.Office.Common.XdmCommunicationManager.createServiceEndPoint(me._webAppState.id);
  4916. var notificationConversationId=me._webAppState.conversationID+OSF.SharedConstants.NotificationConversationIdSuffix;
  4917. me._webAppState.serviceEndPoint.registerConversation(notificationConversationId, me._webAppState.webAppUrl);
  4918. if (this._hostInfo.isDialog && window.opener !=null) {
  4919. return;
  4920. }
  4921. var notifyAgave=function OSF__OfficeAppFactory_initialize$notifyAgave(actionId) {
  4922. switch (actionId) {
  4923. case OSF.AgaveHostAction.Select:
  4924. me._webAppState.focused=true;
  4925. break;
  4926. case OSF.AgaveHostAction.UnSelect:
  4927. me._webAppState.focused=false;
  4928. break;
  4929. case OSF.AgaveHostAction.TabIn:
  4930. case OSF.AgaveHostAction.CtrlF6In:
  4931. window.focus();
  4932. var list=document.querySelectorAll(me._tabbableElements);
  4933. var focused=OSF.OUtil.focusToFirstTabbable(list, false);
  4934. if (!focused) {
  4935. window.blur();
  4936. me._webAppState.focused=false;
  4937. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.ExitNoFocusable]);
  4938. }
  4939. break;
  4940. case OSF.AgaveHostAction.TabInShift:
  4941. window.focus();
  4942. var list=document.querySelectorAll(me._tabbableElements);
  4943. var focused=OSF.OUtil.focusToFirstTabbable(list, true);
  4944. if (!focused) {
  4945. window.blur();
  4946. me._webAppState.focused=false;
  4947. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.ExitNoFocusableShift]);
  4948. }
  4949. break;
  4950. default:
  4951. OsfMsAjaxFactory.msAjaxDebug.trace("actionId "+actionId+" notifyAgave is wrong.");
  4952. break;
  4953. }
  4954. };
  4955. me._webAppState.serviceEndPoint.registerMethod("Office_notifyAgave", notifyAgave, Microsoft.Office.Common.InvokeType.async, false);
  4956. OSF.OUtil.addEventListener(window, "focus", function () {
  4957. if (!me._webAppState.focused) {
  4958. me._webAppState.focused=true;
  4959. }
  4960. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.Select]);
  4961. });
  4962. OSF.OUtil.addEventListener(window, "blur", function () {
  4963. if (!OSF) {
  4964. return;
  4965. }
  4966. if (me._webAppState.focused) {
  4967. me._webAppState.focused=false;
  4968. }
  4969. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.UnSelect]);
  4970. });
  4971. OSF.OUtil.addEventListener(window, "keydown", function (e) {
  4972. e.preventDefault=e.preventDefault || function () {
  4973. e.returnValue=false;
  4974. };
  4975. if (e.keyCode==117 && (e.ctrlKey || e.metaKey)) {
  4976. var actionId=OSF.AgaveHostAction.CtrlF6Exit;
  4977. if (e.shiftKey) {
  4978. actionId=OSF.AgaveHostAction.CtrlF6ExitShift;
  4979. }
  4980. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, actionId]);
  4981. }
  4982. else if (e.keyCode==9) {
  4983. e.preventDefault();
  4984. var allTabbableElements=document.querySelectorAll(me._tabbableElements);
  4985. var focused=OSF.OUtil.focusToNextTabbable(allTabbableElements, e.target || e.srcElement, e.shiftKey);
  4986. if (!focused) {
  4987. if (me._hostInfo.isDialog) {
  4988. OSF.OUtil.focusToFirstTabbable(allTabbableElements, e.shiftKey);
  4989. }
  4990. else {
  4991. if (e.shiftKey) {
  4992. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.TabExitShift]);
  4993. }
  4994. else {
  4995. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.TabExit]);
  4996. }
  4997. }
  4998. }
  4999. }
  5000. else if (e.keyCode==27) {
  5001. e.preventDefault();
  5002. me.dismissDialogNotification && me.dismissDialogNotification();
  5003. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.EscExit]);
  5004. }
  5005. else if (e.keyCode==113) {
  5006. e.preventDefault();
  5007. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.F2Exit]);
  5008. }
  5009. });
  5010. OSF.OUtil.addEventListener(window, "keypress", function (e) {
  5011. if (e.keyCode==117 && e.ctrlKey) {
  5012. if (e.preventDefault) {
  5013. e.preventDefault();
  5014. }
  5015. else {
  5016. e.returnValue=false;
  5017. }
  5018. }
  5019. });
  5020. }
  5021. catch (ex) {
  5022. if (OSF.AppTelemetry) {
  5023. OSF.AppTelemetry.logAppException("Exception thrown in setAgaveHostCommunication. Exception:["+ex+"]");
  5024. }
  5025. throw ex;
  5026. }
  5027. };
  5028. OSF.InitializationHelper.prototype.initWebDialog=function OSF_InitializationHelper$initWebDialog(appContext) {
  5029. if (appContext.get_isDialog()) {
  5030. if (OSF.DDA.UI.ChildUI) {
  5031. var isPopupWindow=(window.opener !=null);
  5032. appContext.ui=new OSF.DDA.UI.ChildUI(isPopupWindow);
  5033. if (isPopupWindow) {
  5034. this.registerMessageReceivedEventForWindowDialog && this.registerMessageReceivedEventForWindowDialog();
  5035. }
  5036. }
  5037. }
  5038. else {
  5039. if (OSF.DDA.UI.ParentUI) {
  5040. appContext.ui=new OSF.DDA.UI.ParentUI();
  5041. if (OfficeExt.Container) {
  5042. OSF.DDA.DispIdHost.addAsyncMethods(appContext.ui, [OSF.DDA.AsyncMethodNames.CloseContainerAsync]);
  5043. }
  5044. }
  5045. }
  5046. };
  5047. OSF.getClientEndPoint=function OSF$getClientEndPoint() {
  5048. var initializationHelper=OSF._OfficeAppFactory.getInitializationHelper();
  5049. return initializationHelper._webAppState.clientEndPoint;
  5050. };
  5051. OSF.InitializationHelper.prototype.prepareRightAfterWebExtensionInitialize=function OSF_InitializationHelper$prepareRightAfterWebExtensionInitialize() {
  5052. if (this._hostInfo.isDialog) {
  5053. window.focus();
  5054. var list=document.querySelectorAll(this._tabbableElements);
  5055. var focused=OSF.OUtil.focusToFirstTabbable(list, false);
  5056. if (!focused) {
  5057. window.blur();
  5058. this._webAppState.focused=false;
  5059. this._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [this._webAppState.id, OSF.AgaveHostAction.ExitNoFocusable]);
  5060. }
  5061. }
  5062. };
  5063. var OSFLog;
  5064. (function (OSFLog) {
  5065. var BaseUsageData=(function () {
  5066. function BaseUsageData(table) {
  5067. this._table=table;
  5068. this._fields={};
  5069. }
  5070. Object.defineProperty(BaseUsageData.prototype, "Fields", {
  5071. get: function () {
  5072. return this._fields;
  5073. },
  5074. enumerable: true,
  5075. configurable: true
  5076. });
  5077. Object.defineProperty(BaseUsageData.prototype, "Table", {
  5078. get: function () {
  5079. return this._table;
  5080. },
  5081. enumerable: true,
  5082. configurable: true
  5083. });
  5084. BaseUsageData.prototype.SerializeFields=function () {
  5085. };
  5086. BaseUsageData.prototype.SetSerializedField=function (key, value) {
  5087. if (typeof (value) !=="undefined" && value !==null) {
  5088. this._serializedFields[key]=value.toString();
  5089. }
  5090. };
  5091. BaseUsageData.prototype.SerializeRow=function () {
  5092. this._serializedFields={};
  5093. this.SetSerializedField("Table", this._table);
  5094. this.SerializeFields();
  5095. return JSON.stringify(this._serializedFields);
  5096. };
  5097. return BaseUsageData;
  5098. })();
  5099. OSFLog.BaseUsageData=BaseUsageData;
  5100. var AppActivatedUsageData=(function (_super) {
  5101. __extends(AppActivatedUsageData, _super);
  5102. function AppActivatedUsageData() {
  5103. _super.call(this, "AppActivated");
  5104. }
  5105. Object.defineProperty(AppActivatedUsageData.prototype, "CorrelationId", {
  5106. get: function () { return this.Fields["CorrelationId"]; },
  5107. set: function (value) { this.Fields["CorrelationId"]=value; },
  5108. enumerable: true,
  5109. configurable: true
  5110. });
  5111. Object.defineProperty(AppActivatedUsageData.prototype, "SessionId", {
  5112. get: function () { return this.Fields["SessionId"]; },
  5113. set: function (value) { this.Fields["SessionId"]=value; },
  5114. enumerable: true,
  5115. configurable: true
  5116. });
  5117. Object.defineProperty(AppActivatedUsageData.prototype, "AppId", {
  5118. get: function () { return this.Fields["AppId"]; },
  5119. set: function (value) { this.Fields["AppId"]=value; },
  5120. enumerable: true,
  5121. configurable: true
  5122. });
  5123. Object.defineProperty(AppActivatedUsageData.prototype, "AppInstanceId", {
  5124. get: function () { return this.Fields["AppInstanceId"]; },
  5125. set: function (value) { this.Fields["AppInstanceId"]=value; },
  5126. enumerable: true,
  5127. configurable: true
  5128. });
  5129. Object.defineProperty(AppActivatedUsageData.prototype, "AppURL", {
  5130. get: function () { return this.Fields["AppURL"]; },
  5131. set: function (value) { this.Fields["AppURL"]=value; },
  5132. enumerable: true,
  5133. configurable: true
  5134. });
  5135. Object.defineProperty(AppActivatedUsageData.prototype, "AssetId", {
  5136. get: function () { return this.Fields["AssetId"]; },
  5137. set: function (value) { this.Fields["AssetId"]=value; },
  5138. enumerable: true,
  5139. configurable: true
  5140. });
  5141. Object.defineProperty(AppActivatedUsageData.prototype, "Browser", {
  5142. get: function () { return this.Fields["Browser"]; },
  5143. set: function (value) { this.Fields["Browser"]=value; },
  5144. enumerable: true,
  5145. configurable: true
  5146. });
  5147. Object.defineProperty(AppActivatedUsageData.prototype, "UserId", {
  5148. get: function () { return this.Fields["UserId"]; },
  5149. set: function (value) { this.Fields["UserId"]=value; },
  5150. enumerable: true,
  5151. configurable: true
  5152. });
  5153. Object.defineProperty(AppActivatedUsageData.prototype, "Host", {
  5154. get: function () { return this.Fields["Host"]; },
  5155. set: function (value) { this.Fields["Host"]=value; },
  5156. enumerable: true,
  5157. configurable: true
  5158. });
  5159. Object.defineProperty(AppActivatedUsageData.prototype, "HostVersion", {
  5160. get: function () { return this.Fields["HostVersion"]; },
  5161. set: function (value) { this.Fields["HostVersion"]=value; },
  5162. enumerable: true,
  5163. configurable: true
  5164. });
  5165. Object.defineProperty(AppActivatedUsageData.prototype, "ClientId", {
  5166. get: function () { return this.Fields["ClientId"]; },
  5167. set: function (value) { this.Fields["ClientId"]=value; },
  5168. enumerable: true,
  5169. configurable: true
  5170. });
  5171. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeWidth", {
  5172. get: function () { return this.Fields["AppSizeWidth"]; },
  5173. set: function (value) { this.Fields["AppSizeWidth"]=value; },
  5174. enumerable: true,
  5175. configurable: true
  5176. });
  5177. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeHeight", {
  5178. get: function () { return this.Fields["AppSizeHeight"]; },
  5179. set: function (value) { this.Fields["AppSizeHeight"]=value; },
  5180. enumerable: true,
  5181. configurable: true
  5182. });
  5183. Object.defineProperty(AppActivatedUsageData.prototype, "Message", {
  5184. get: function () { return this.Fields["Message"]; },
  5185. set: function (value) { this.Fields["Message"]=value; },
  5186. enumerable: true,
  5187. configurable: true
  5188. });
  5189. Object.defineProperty(AppActivatedUsageData.prototype, "DocUrl", {
  5190. get: function () { return this.Fields["DocUrl"]; },
  5191. set: function (value) { this.Fields["DocUrl"]=value; },
  5192. enumerable: true,
  5193. configurable: true
  5194. });
  5195. Object.defineProperty(AppActivatedUsageData.prototype, "OfficeJSVersion", {
  5196. get: function () { return this.Fields["OfficeJSVersion"]; },
  5197. set: function (value) { this.Fields["OfficeJSVersion"]=value; },
  5198. enumerable: true,
  5199. configurable: true
  5200. });
  5201. Object.defineProperty(AppActivatedUsageData.prototype, "HostJSVersion", {
  5202. get: function () { return this.Fields["HostJSVersion"]; },
  5203. set: function (value) { this.Fields["HostJSVersion"]=value; },
  5204. enumerable: true,
  5205. configurable: true
  5206. });
  5207. AppActivatedUsageData.prototype.SerializeFields=function () {
  5208. this.SetSerializedField("CorrelationId", this.CorrelationId);
  5209. this.SetSerializedField("SessionId", this.SessionId);
  5210. this.SetSerializedField("AppId", this.AppId);
  5211. this.SetSerializedField("AppInstanceId", this.AppInstanceId);
  5212. this.SetSerializedField("AppURL", this.AppURL);
  5213. this.SetSerializedField("AssetId", this.AssetId);
  5214. this.SetSerializedField("Browser", this.Browser);
  5215. this.SetSerializedField("UserId", this.UserId);
  5216. this.SetSerializedField("Host", this.Host);
  5217. this.SetSerializedField("HostVersion", this.HostVersion);
  5218. this.SetSerializedField("ClientId", this.ClientId);
  5219. this.SetSerializedField("AppSizeWidth", this.AppSizeWidth);
  5220. this.SetSerializedField("AppSizeHeight", this.AppSizeHeight);
  5221. this.SetSerializedField("Message", this.Message);
  5222. this.SetSerializedField("DocUrl", this.DocUrl);
  5223. this.SetSerializedField("OfficeJSVersion", this.OfficeJSVersion);
  5224. this.SetSerializedField("HostJSVersion", this.HostJSVersion);
  5225. };
  5226. return AppActivatedUsageData;
  5227. })(BaseUsageData);
  5228. OSFLog.AppActivatedUsageData=AppActivatedUsageData;
  5229. var ScriptLoadUsageData=(function (_super) {
  5230. __extends(ScriptLoadUsageData, _super);
  5231. function ScriptLoadUsageData() {
  5232. _super.call(this, "ScriptLoad");
  5233. }
  5234. Object.defineProperty(ScriptLoadUsageData.prototype, "CorrelationId", {
  5235. get: function () { return this.Fields["CorrelationId"]; },
  5236. set: function (value) { this.Fields["CorrelationId"]=value; },
  5237. enumerable: true,
  5238. configurable: true
  5239. });
  5240. Object.defineProperty(ScriptLoadUsageData.prototype, "SessionId", {
  5241. get: function () { return this.Fields["SessionId"]; },
  5242. set: function (value) { this.Fields["SessionId"]=value; },
  5243. enumerable: true,
  5244. configurable: true
  5245. });
  5246. Object.defineProperty(ScriptLoadUsageData.prototype, "ScriptId", {
  5247. get: function () { return this.Fields["ScriptId"]; },
  5248. set: function (value) { this.Fields["ScriptId"]=value; },
  5249. enumerable: true,
  5250. configurable: true
  5251. });
  5252. Object.defineProperty(ScriptLoadUsageData.prototype, "StartTime", {
  5253. get: function () { return this.Fields["StartTime"]; },
  5254. set: function (value) { this.Fields["StartTime"]=value; },
  5255. enumerable: true,
  5256. configurable: true
  5257. });
  5258. Object.defineProperty(ScriptLoadUsageData.prototype, "ResponseTime", {
  5259. get: function () { return this.Fields["ResponseTime"]; },
  5260. set: function (value) { this.Fields["ResponseTime"]=value; },
  5261. enumerable: true,
  5262. configurable: true
  5263. });
  5264. ScriptLoadUsageData.prototype.SerializeFields=function () {
  5265. this.SetSerializedField("CorrelationId", this.CorrelationId);
  5266. this.SetSerializedField("SessionId", this.SessionId);
  5267. this.SetSerializedField("ScriptId", this.ScriptId);
  5268. this.SetSerializedField("StartTime", this.StartTime);
  5269. this.SetSerializedField("ResponseTime", this.ResponseTime);
  5270. };
  5271. return ScriptLoadUsageData;
  5272. })(BaseUsageData);
  5273. OSFLog.ScriptLoadUsageData=ScriptLoadUsageData;
  5274. var AppClosedUsageData=(function (_super) {
  5275. __extends(AppClosedUsageData, _super);
  5276. function AppClosedUsageData() {
  5277. _super.call(this, "AppClosed");
  5278. }
  5279. Object.defineProperty(AppClosedUsageData.prototype, "CorrelationId", {
  5280. get: function () { return this.Fields["CorrelationId"]; },
  5281. set: function (value) { this.Fields["CorrelationId"]=value; },
  5282. enumerable: true,
  5283. configurable: true
  5284. });
  5285. Object.defineProperty(AppClosedUsageData.prototype, "SessionId", {
  5286. get: function () { return this.Fields["SessionId"]; },
  5287. set: function (value) { this.Fields["SessionId"]=value; },
  5288. enumerable: true,
  5289. configurable: true
  5290. });
  5291. Object.defineProperty(AppClosedUsageData.prototype, "FocusTime", {
  5292. get: function () { return this.Fields["FocusTime"]; },
  5293. set: function (value) { this.Fields["FocusTime"]=value; },
  5294. enumerable: true,
  5295. configurable: true
  5296. });
  5297. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalWidth", {
  5298. get: function () { return this.Fields["AppSizeFinalWidth"]; },
  5299. set: function (value) { this.Fields["AppSizeFinalWidth"]=value; },
  5300. enumerable: true,
  5301. configurable: true
  5302. });
  5303. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalHeight", {
  5304. get: function () { return this.Fields["AppSizeFinalHeight"]; },
  5305. set: function (value) { this.Fields["AppSizeFinalHeight"]=value; },
  5306. enumerable: true,
  5307. configurable: true
  5308. });
  5309. Object.defineProperty(AppClosedUsageData.prototype, "OpenTime", {
  5310. get: function () { return this.Fields["OpenTime"]; },
  5311. set: function (value) { this.Fields["OpenTime"]=value; },
  5312. enumerable: true,
  5313. configurable: true
  5314. });
  5315. Object.defineProperty(AppClosedUsageData.prototype, "CloseMethod", {
  5316. get: function () { return this.Fields["CloseMethod"]; },
  5317. set: function (value) { this.Fields["CloseMethod"]=value; },
  5318. enumerable: true,
  5319. configurable: true
  5320. });
  5321. AppClosedUsageData.prototype.SerializeFields=function () {
  5322. this.SetSerializedField("CorrelationId", this.CorrelationId);
  5323. this.SetSerializedField("SessionId", this.SessionId);
  5324. this.SetSerializedField("FocusTime", this.FocusTime);
  5325. this.SetSerializedField("AppSizeFinalWidth", this.AppSizeFinalWidth);
  5326. this.SetSerializedField("AppSizeFinalHeight", this.AppSizeFinalHeight);
  5327. this.SetSerializedField("OpenTime", this.OpenTime);
  5328. this.SetSerializedField("CloseMethod", this.CloseMethod);
  5329. };
  5330. return AppClosedUsageData;
  5331. })(BaseUsageData);
  5332. OSFLog.AppClosedUsageData=AppClosedUsageData;
  5333. var APIUsageUsageData=(function (_super) {
  5334. __extends(APIUsageUsageData, _super);
  5335. function APIUsageUsageData() {
  5336. _super.call(this, "APIUsage");
  5337. }
  5338. Object.defineProperty(APIUsageUsageData.prototype, "CorrelationId", {
  5339. get: function () { return this.Fields["CorrelationId"]; },
  5340. set: function (value) { this.Fields["CorrelationId"]=value; },
  5341. enumerable: true,
  5342. configurable: true
  5343. });
  5344. Object.defineProperty(APIUsageUsageData.prototype, "SessionId", {
  5345. get: function () { return this.Fields["SessionId"]; },
  5346. set: function (value) { this.Fields["SessionId"]=value; },
  5347. enumerable: true,
  5348. configurable: true
  5349. });
  5350. Object.defineProperty(APIUsageUsageData.prototype, "APIType", {
  5351. get: function () { return this.Fields["APIType"]; },
  5352. set: function (value) { this.Fields["APIType"]=value; },
  5353. enumerable: true,
  5354. configurable: true
  5355. });
  5356. Object.defineProperty(APIUsageUsageData.prototype, "APIID", {
  5357. get: function () { return this.Fields["APIID"]; },
  5358. set: function (value) { this.Fields["APIID"]=value; },
  5359. enumerable: true,
  5360. configurable: true
  5361. });
  5362. Object.defineProperty(APIUsageUsageData.prototype, "Parameters", {
  5363. get: function () { return this.Fields["Parameters"]; },
  5364. set: function (value) { this.Fields["Parameters"]=value; },
  5365. enumerable: true,
  5366. configurable: true
  5367. });
  5368. Object.defineProperty(APIUsageUsageData.prototype, "ResponseTime", {
  5369. get: function () { return this.Fields["ResponseTime"]; },
  5370. set: function (value) { this.Fields["ResponseTime"]=value; },
  5371. enumerable: true,
  5372. configurable: true
  5373. });
  5374. Object.defineProperty(APIUsageUsageData.prototype, "ErrorType", {
  5375. get: function () { return this.Fields["ErrorType"]; },
  5376. set: function (value) { this.Fields["ErrorType"]=value; },
  5377. enumerable: true,
  5378. configurable: true
  5379. });
  5380. APIUsageUsageData.prototype.SerializeFields=function () {
  5381. this.SetSerializedField("CorrelationId", this.CorrelationId);
  5382. this.SetSerializedField("SessionId", this.SessionId);
  5383. this.SetSerializedField("APIType", this.APIType);
  5384. this.SetSerializedField("APIID", this.APIID);
  5385. this.SetSerializedField("Parameters", this.Parameters);
  5386. this.SetSerializedField("ResponseTime", this.ResponseTime);
  5387. this.SetSerializedField("ErrorType", this.ErrorType);
  5388. };
  5389. return APIUsageUsageData;
  5390. })(BaseUsageData);
  5391. OSFLog.APIUsageUsageData=APIUsageUsageData;
  5392. var AppInitializationUsageData=(function (_super) {
  5393. __extends(AppInitializationUsageData, _super);
  5394. function AppInitializationUsageData() {
  5395. _super.call(this, "AppInitialization");
  5396. }
  5397. Object.defineProperty(AppInitializationUsageData.prototype, "CorrelationId", {
  5398. get: function () { return this.Fields["CorrelationId"]; },
  5399. set: function (value) { this.Fields["CorrelationId"]=value; },
  5400. enumerable: true,
  5401. configurable: true
  5402. });
  5403. Object.defineProperty(AppInitializationUsageData.prototype, "SessionId", {
  5404. get: function () { return this.Fields["SessionId"]; },
  5405. set: function (value) { this.Fields["SessionId"]=value; },
  5406. enumerable: true,
  5407. configurable: true
  5408. });
  5409. Object.defineProperty(AppInitializationUsageData.prototype, "SuccessCode", {
  5410. get: function () { return this.Fields["SuccessCode"]; },
  5411. set: function (value) { this.Fields["SuccessCode"]=value; },
  5412. enumerable: true,
  5413. configurable: true
  5414. });
  5415. Object.defineProperty(AppInitializationUsageData.prototype, "Message", {
  5416. get: function () { return this.Fields["Message"]; },
  5417. set: function (value) { this.Fields["Message"]=value; },
  5418. enumerable: true,
  5419. configurable: true
  5420. });
  5421. AppInitializationUsageData.prototype.SerializeFields=function () {
  5422. this.SetSerializedField("CorrelationId", this.CorrelationId);
  5423. this.SetSerializedField("SessionId", this.SessionId);
  5424. this.SetSerializedField("SuccessCode", this.SuccessCode);
  5425. this.SetSerializedField("Message", this.Message);
  5426. };
  5427. return AppInitializationUsageData;
  5428. })(BaseUsageData);
  5429. OSFLog.AppInitializationUsageData=AppInitializationUsageData;
  5430. })(OSFLog || (OSFLog={}));
  5431. var Logger;
  5432. (function (Logger) {
  5433. "use strict";
  5434. (function (TraceLevel) {
  5435. TraceLevel[TraceLevel["info"]=0]="info";
  5436. TraceLevel[TraceLevel["warning"]=1]="warning";
  5437. TraceLevel[TraceLevel["error"]=2]="error";
  5438. })(Logger.TraceLevel || (Logger.TraceLevel={}));
  5439. var TraceLevel=Logger.TraceLevel;
  5440. (function (SendFlag) {
  5441. SendFlag[SendFlag["none"]=0]="none";
  5442. SendFlag[SendFlag["flush"]=1]="flush";
  5443. })(Logger.SendFlag || (Logger.SendFlag={}));
  5444. var SendFlag=Logger.SendFlag;
  5445. function allowUploadingData() {
  5446. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  5447. OSF.Logger.ulsEndpoint.loadProxyFrame();
  5448. }
  5449. }
  5450. Logger.allowUploadingData=allowUploadingData;
  5451. function sendLog(traceLevel, message, flag) {
  5452. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  5453. var jsonObj={ traceLevel: traceLevel, message: message, flag: flag, internalLog: true };
  5454. var logs=JSON.stringify(jsonObj);
  5455. OSF.Logger.ulsEndpoint.writeLog(logs);
  5456. }
  5457. }
  5458. Logger.sendLog=sendLog;
  5459. function creatULSEndpoint() {
  5460. try {
  5461. return new ULSEndpointProxy();
  5462. }
  5463. catch (e) {
  5464. return null;
  5465. }
  5466. }
  5467. var ULSEndpointProxy=(function () {
  5468. function ULSEndpointProxy() {
  5469. var _this=this;
  5470. this.proxyFrame=null;
  5471. this.telemetryEndPoint="https://telemetryservice.firstpartyapps.oaspapps.com/telemetryservice/telemetryproxy.html";
  5472. this.buffer=[];
  5473. this.proxyFrameReady=false;
  5474. OSF.OUtil.addEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  5475. setTimeout(function () {
  5476. _this.loadProxyFrame();
  5477. }, 3000);
  5478. }
  5479. ULSEndpointProxy.prototype.writeLog=function (log) {
  5480. if (this.proxyFrameReady===true) {
  5481. this.proxyFrame.contentWindow.postMessage(log, ULSEndpointProxy.telemetryOrigin);
  5482. }
  5483. else {
  5484. if (this.buffer.length < 128) {
  5485. this.buffer.push(log);
  5486. }
  5487. }
  5488. };
  5489. ULSEndpointProxy.prototype.loadProxyFrame=function () {
  5490. if (this.proxyFrame==null) {
  5491. this.proxyFrame=document.createElement("iframe");
  5492. this.proxyFrame.setAttribute("style", "display:none");
  5493. this.proxyFrame.setAttribute("src", this.telemetryEndPoint);
  5494. document.head.appendChild(this.proxyFrame);
  5495. }
  5496. };
  5497. ULSEndpointProxy.prototype.tellProxyFrameReady=function (e) {
  5498. var _this=this;
  5499. if (e.data==="ProxyFrameReadyToLog") {
  5500. this.proxyFrameReady=true;
  5501. for (var i=0; i < this.buffer.length; i++) {
  5502. this.writeLog(this.buffer[i]);
  5503. }
  5504. this.buffer.length=0;
  5505. OSF.OUtil.removeEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  5506. }
  5507. else if (e.data==="ProxyFrameReadyToInit") {
  5508. var initJson={ appName: "Office APPs", sessionId: OSF.OUtil.Guid.generateNewGuid() };
  5509. var initStr=JSON.stringify(initJson);
  5510. this.proxyFrame.contentWindow.postMessage(initStr, ULSEndpointProxy.telemetryOrigin);
  5511. }
  5512. };
  5513. ULSEndpointProxy.telemetryOrigin="https://telemetryservice.firstpartyapps.oaspapps.com";
  5514. return ULSEndpointProxy;
  5515. })();
  5516. if (!OSF.Logger) {
  5517. OSF.Logger=Logger;
  5518. }
  5519. Logger.ulsEndpoint=creatULSEndpoint();
  5520. })(Logger || (Logger={}));
  5521. var OSFAppTelemetry;
  5522. (function (OSFAppTelemetry) {
  5523. "use strict";
  5524. var appInfo;
  5525. var sessionId=OSF.OUtil.Guid.generateNewGuid();
  5526. var osfControlAppCorrelationId="";
  5527. var omexDomainRegex=new RegExp("^https?://store\\.office(ppe|-int)?\\.com/", "i");
  5528. ;
  5529. var AppInfo=(function () {
  5530. function AppInfo() {
  5531. }
  5532. return AppInfo;
  5533. })();
  5534. var Event=(function () {
  5535. function Event(name, handler) {
  5536. this.name=name;
  5537. this.handler=handler;
  5538. }
  5539. return Event;
  5540. })();
  5541. var AppStorage=(function () {
  5542. function AppStorage() {
  5543. this.clientIDKey="Office API client";
  5544. this.logIdSetKey="Office App Log Id Set";
  5545. }
  5546. AppStorage.prototype.getClientId=function () {
  5547. var clientId=this.getValue(this.clientIDKey);
  5548. if (!clientId || clientId.length <=0 || clientId.length > 40) {
  5549. clientId=OSF.OUtil.Guid.generateNewGuid();
  5550. this.setValue(this.clientIDKey, clientId);
  5551. }
  5552. return clientId;
  5553. };
  5554. AppStorage.prototype.saveLog=function (logId, log) {
  5555. var logIdSet=this.getValue(this.logIdSetKey);
  5556. logIdSet=((logIdSet && logIdSet.length > 0) ? (logIdSet+";") : "")+logId;
  5557. this.setValue(this.logIdSetKey, logIdSet);
  5558. this.setValue(logId, log);
  5559. };
  5560. AppStorage.prototype.enumerateLog=function (callback, clean) {
  5561. var logIdSet=this.getValue(this.logIdSetKey);
  5562. if (logIdSet) {
  5563. var ids=logIdSet.split(";");
  5564. for (var id in ids) {
  5565. var logId=ids[id];
  5566. var log=this.getValue(logId);
  5567. if (log) {
  5568. if (callback) {
  5569. callback(logId, log);
  5570. }
  5571. if (clean) {
  5572. this.remove(logId);
  5573. }
  5574. }
  5575. }
  5576. if (clean) {
  5577. this.remove(this.logIdSetKey);
  5578. }
  5579. }
  5580. };
  5581. AppStorage.prototype.getValue=function (key) {
  5582. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  5583. var value="";
  5584. if (osfLocalStorage) {
  5585. value=osfLocalStorage.getItem(key);
  5586. }
  5587. return value;
  5588. };
  5589. AppStorage.prototype.setValue=function (key, value) {
  5590. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  5591. if (osfLocalStorage) {
  5592. osfLocalStorage.setItem(key, value);
  5593. }
  5594. };
  5595. AppStorage.prototype.remove=function (key) {
  5596. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  5597. if (osfLocalStorage) {
  5598. try {
  5599. osfLocalStorage.removeItem(key);
  5600. }
  5601. catch (ex) {
  5602. }
  5603. }
  5604. };
  5605. return AppStorage;
  5606. })();
  5607. var AppLogger=(function () {
  5608. function AppLogger() {
  5609. }
  5610. AppLogger.prototype.LogData=function (data) {
  5611. if (!OSF.Logger) {
  5612. return;
  5613. }
  5614. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, data.SerializeRow(), OSF.Logger.SendFlag.none);
  5615. };
  5616. AppLogger.prototype.LogRawData=function (log) {
  5617. if (!OSF.Logger) {
  5618. return;
  5619. }
  5620. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, log, OSF.Logger.SendFlag.none);
  5621. };
  5622. return AppLogger;
  5623. })();
  5624. function initialize(context) {
  5625. if (!OSF.Logger) {
  5626. return;
  5627. }
  5628. if (appInfo) {
  5629. return;
  5630. }
  5631. appInfo=new AppInfo();
  5632. if (context.get_hostFullVersion()) {
  5633. appInfo.hostVersion=context.get_hostFullVersion();
  5634. }
  5635. else {
  5636. appInfo.hostVersion=context.get_appVersion();
  5637. }
  5638. appInfo.appId=context.get_id();
  5639. appInfo.host=context.get_appName();
  5640. appInfo.browser=window.navigator.userAgent;
  5641. appInfo.correlationId=context.get_correlationId();
  5642. appInfo.clientId=(new AppStorage()).getClientId();
  5643. appInfo.appInstanceId=context.get_appInstanceId();
  5644. if (appInfo.appInstanceId) {
  5645. appInfo.appInstanceId=appInfo.appInstanceId.replace(/[{}]/g, "").toLowerCase();
  5646. }
  5647. appInfo.message=context.get_hostCustomMessage();
  5648. appInfo.officeJSVersion=OSF.ConstantNames.FileVersion;
  5649. appInfo.hostJSVersion="16.0.7607.3000";
  5650. var docUrl=context.get_docUrl();
  5651. appInfo.docUrl=omexDomainRegex.test(docUrl) ? docUrl : "";
  5652. var url=location.href;
  5653. if (url) {
  5654. url=url.split("?")[0].split("#")[0];
  5655. }
  5656. appInfo.appURL=url;
  5657. (function getUserIdAndAssetIdFromToken(token, appInfo) {
  5658. var xmlContent;
  5659. var parser;
  5660. var xmlDoc;
  5661. appInfo.assetId="";
  5662. appInfo.userId="";
  5663. try {
  5664. xmlContent=decodeURIComponent(token);
  5665. parser=new DOMParser();
  5666. xmlDoc=parser.parseFromString(xmlContent, "text/xml");
  5667. var cidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("cid");
  5668. var oidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("oid");
  5669. if (cidNode && cidNode.nodeValue) {
  5670. appInfo.userId=cidNode.nodeValue;
  5671. }
  5672. else if (oidNode && oidNode.nodeValue) {
  5673. appInfo.userId=oidNode.nodeValue;
  5674. }
  5675. appInfo.assetId=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("aid").nodeValue;
  5676. }
  5677. catch (e) {
  5678. }
  5679. finally {
  5680. xmlContent=null;
  5681. xmlDoc=null;
  5682. parser=null;
  5683. }
  5684. })(context.get_eToken(), appInfo);
  5685. (function handleLifecycle() {
  5686. var startTime=new Date();
  5687. var lastFocus=null;
  5688. var focusTime=0;
  5689. var finished=false;
  5690. var adjustFocusTime=function () {
  5691. if (document.hasFocus()) {
  5692. if (lastFocus==null) {
  5693. lastFocus=new Date();
  5694. }
  5695. }
  5696. else if (lastFocus) {
  5697. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  5698. lastFocus=null;
  5699. }
  5700. };
  5701. var eventList=[];
  5702. eventList.push(new Event("focus", adjustFocusTime));
  5703. eventList.push(new Event("blur", adjustFocusTime));
  5704. eventList.push(new Event("focusout", adjustFocusTime));
  5705. eventList.push(new Event("focusin", adjustFocusTime));
  5706. var exitFunction=function () {
  5707. for (var i=0; i < eventList.length; i++) {
  5708. OSF.OUtil.removeEventListener(window, eventList[i].name, eventList[i].handler);
  5709. }
  5710. eventList.length=0;
  5711. if (!finished) {
  5712. if (document.hasFocus() && lastFocus) {
  5713. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  5714. lastFocus=null;
  5715. }
  5716. OSFAppTelemetry.onAppClosed(Math.abs((new Date()).getTime() - startTime.getTime()), focusTime);
  5717. finished=true;
  5718. }
  5719. };
  5720. eventList.push(new Event("beforeunload", exitFunction));
  5721. eventList.push(new Event("unload", exitFunction));
  5722. for (var i=0; i < eventList.length; i++) {
  5723. OSF.OUtil.addEventListener(window, eventList[i].name, eventList[i].handler);
  5724. }
  5725. adjustFocusTime();
  5726. })();
  5727. OSFAppTelemetry.onAppActivated();
  5728. }
  5729. OSFAppTelemetry.initialize=initialize;
  5730. function onAppActivated() {
  5731. if (!appInfo) {
  5732. return;
  5733. }
  5734. (new AppStorage()).enumerateLog(function (id, log) { return (new AppLogger()).LogRawData(log); }, true);
  5735. var data=new OSFLog.AppActivatedUsageData();
  5736. data.SessionId=sessionId;
  5737. data.AppId=appInfo.appId;
  5738. data.AssetId=appInfo.assetId;
  5739. data.AppURL=appInfo.appURL;
  5740. data.UserId=appInfo.userId;
  5741. data.ClientId=appInfo.clientId;
  5742. data.Browser=appInfo.browser;
  5743. data.Host=appInfo.host;
  5744. data.HostVersion=appInfo.hostVersion;
  5745. data.CorrelationId=appInfo.correlationId;
  5746. data.AppSizeWidth=window.innerWidth;
  5747. data.AppSizeHeight=window.innerHeight;
  5748. data.AppInstanceId=appInfo.appInstanceId;
  5749. data.Message=appInfo.message;
  5750. data.DocUrl=appInfo.docUrl;
  5751. data.OfficeJSVersion=appInfo.officeJSVersion;
  5752. data.HostJSVersion=appInfo.hostJSVersion;
  5753. (new AppLogger()).LogData(data);
  5754. setTimeout(function () {
  5755. if (!OSF.Logger) {
  5756. return;
  5757. }
  5758. OSF.Logger.allowUploadingData();
  5759. }, 100);
  5760. }
  5761. OSFAppTelemetry.onAppActivated=onAppActivated;
  5762. function onScriptDone(scriptId, msStartTime, msResponseTime, appCorrelationId) {
  5763. var data=new OSFLog.ScriptLoadUsageData();
  5764. data.CorrelationId=appCorrelationId;
  5765. data.SessionId=sessionId;
  5766. data.ScriptId=scriptId;
  5767. data.StartTime=msStartTime;
  5768. data.ResponseTime=msResponseTime;
  5769. (new AppLogger()).LogData(data);
  5770. }
  5771. OSFAppTelemetry.onScriptDone=onScriptDone;
  5772. function onCallDone(apiType, id, parameters, msResponseTime, errorType) {
  5773. if (!appInfo) {
  5774. return;
  5775. }
  5776. var data=new OSFLog.APIUsageUsageData();
  5777. data.CorrelationId=osfControlAppCorrelationId;
  5778. data.SessionId=sessionId;
  5779. data.APIType=apiType;
  5780. data.APIID=id;
  5781. data.Parameters=parameters;
  5782. data.ResponseTime=msResponseTime;
  5783. data.ErrorType=errorType;
  5784. (new AppLogger()).LogData(data);
  5785. }
  5786. OSFAppTelemetry.onCallDone=onCallDone;
  5787. ;
  5788. function onMethodDone(id, args, msResponseTime, errorType) {
  5789. var parameters=null;
  5790. if (args) {
  5791. if (typeof args=="number") {
  5792. parameters=String(args);
  5793. }
  5794. else if (typeof args==="object") {
  5795. for (var index in args) {
  5796. if (parameters !==null) {
  5797. parameters+=",";
  5798. }
  5799. else {
  5800. parameters="";
  5801. }
  5802. if (typeof args[index]=="number") {
  5803. parameters+=String(args[index]);
  5804. }
  5805. }
  5806. }
  5807. else {
  5808. parameters="";
  5809. }
  5810. }
  5811. OSF.AppTelemetry.onCallDone("method", id, parameters, msResponseTime, errorType);
  5812. }
  5813. OSFAppTelemetry.onMethodDone=onMethodDone;
  5814. function onPropertyDone(propertyName, msResponseTime) {
  5815. OSF.AppTelemetry.onCallDone("property", -1, propertyName, msResponseTime);
  5816. }
  5817. OSFAppTelemetry.onPropertyDone=onPropertyDone;
  5818. function onEventDone(id, errorType) {
  5819. OSF.AppTelemetry.onCallDone("event", id, null, 0, errorType);
  5820. }
  5821. OSFAppTelemetry.onEventDone=onEventDone;
  5822. function onRegisterDone(register, id, msResponseTime, errorType) {
  5823. OSF.AppTelemetry.onCallDone(register ? "registerevent" : "unregisterevent", id, null, msResponseTime, errorType);
  5824. }
  5825. OSFAppTelemetry.onRegisterDone=onRegisterDone;
  5826. function onAppClosed(openTime, focusTime) {
  5827. if (!appInfo) {
  5828. return;
  5829. }
  5830. var data=new OSFLog.AppClosedUsageData();
  5831. data.CorrelationId=osfControlAppCorrelationId;
  5832. data.SessionId=sessionId;
  5833. data.FocusTime=focusTime;
  5834. data.OpenTime=openTime;
  5835. data.AppSizeFinalWidth=window.innerWidth;
  5836. data.AppSizeFinalHeight=window.innerHeight;
  5837. (new AppStorage()).saveLog(sessionId, data.SerializeRow());
  5838. }
  5839. OSFAppTelemetry.onAppClosed=onAppClosed;
  5840. function setOsfControlAppCorrelationId(correlationId) {
  5841. osfControlAppCorrelationId=correlationId;
  5842. }
  5843. OSFAppTelemetry.setOsfControlAppCorrelationId=setOsfControlAppCorrelationId;
  5844. function doAppInitializationLogging(isException, message) {
  5845. var data=new OSFLog.AppInitializationUsageData();
  5846. data.CorrelationId=osfControlAppCorrelationId;
  5847. data.SessionId=sessionId;
  5848. data.SuccessCode=isException ? 1 : 0;
  5849. data.Message=message;
  5850. (new AppLogger()).LogData(data);
  5851. }
  5852. OSFAppTelemetry.doAppInitializationLogging=doAppInitializationLogging;
  5853. function logAppCommonMessage(message) {
  5854. doAppInitializationLogging(false, message);
  5855. }
  5856. OSFAppTelemetry.logAppCommonMessage=logAppCommonMessage;
  5857. function logAppException(errorMessage) {
  5858. doAppInitializationLogging(true, errorMessage);
  5859. }
  5860. OSFAppTelemetry.logAppException=logAppException;
  5861. OSF.AppTelemetry=OSFAppTelemetry;
  5862. })(OSFAppTelemetry || (OSFAppTelemetry={}));
  5863. Microsoft.Office.WebExtension.TableData=function Microsoft_Office_WebExtension_TableData(rows, headers) {
  5864. function fixData(data) {
  5865. if (data==null || data==undefined) {
  5866. return null;
  5867. }
  5868. try {
  5869. for (var dim=OSF.DDA.DataCoercion.findArrayDimensionality(data, 2); dim < 2; dim++) {
  5870. data=[data];
  5871. }
  5872. return data;
  5873. }
  5874. catch (ex) {
  5875. }
  5876. }
  5877. ;
  5878. OSF.OUtil.defineEnumerableProperties(this, {
  5879. "headers": {
  5880. get: function () { return headers; },
  5881. set: function (value) {
  5882. headers=fixData(value);
  5883. }
  5884. },
  5885. "rows": {
  5886. get: function () { return rows; },
  5887. set: function (value) {
  5888. rows=(value==null || (OSF.OUtil.isArray(value) && (value.length==0))) ?
  5889. [] :
  5890. fixData(value);
  5891. }
  5892. }
  5893. });
  5894. this.headers=headers;
  5895. this.rows=rows;
  5896. };
  5897. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  5898. OSF.DDA.OMFactory.manufactureTableData=function OSF_DDA_OMFactory$manufactureTableData(tableDataProperties) {
  5899. return new Microsoft.Office.WebExtension.TableData(tableDataProperties[OSF.DDA.TableDataProperties.TableRows], tableDataProperties[OSF.DDA.TableDataProperties.TableHeaders]);
  5900. };
  5901. Microsoft.Office.WebExtension.CoercionType={
  5902. Text: "text",
  5903. Matrix: "matrix",
  5904. Table: "table"
  5905. };
  5906. OSF.DDA.DataCoercion=(function OSF_DDA_DataCoercion() {
  5907. return {
  5908. findArrayDimensionality: function OSF_DDA_DataCoercion$findArrayDimensionality(obj) {
  5909. if (OSF.OUtil.isArray(obj)) {
  5910. var dim=0;
  5911. for (var index=0; index < obj.length; index++) {
  5912. dim=Math.max(dim, OSF.DDA.DataCoercion.findArrayDimensionality(obj[index]));
  5913. }
  5914. return dim+1;
  5915. }
  5916. else {
  5917. return 0;
  5918. }
  5919. },
  5920. getCoercionDefaultForBinding: function OSF_DDA_DataCoercion$getCoercionDefaultForBinding(bindingType) {
  5921. switch (bindingType) {
  5922. case Microsoft.Office.WebExtension.BindingType.Matrix: return Microsoft.Office.WebExtension.CoercionType.Matrix;
  5923. case Microsoft.Office.WebExtension.BindingType.Table: return Microsoft.Office.WebExtension.CoercionType.Table;
  5924. case Microsoft.Office.WebExtension.BindingType.Text:
  5925. default:
  5926. return Microsoft.Office.WebExtension.CoercionType.Text;
  5927. }
  5928. },
  5929. getBindingDefaultForCoercion: function OSF_DDA_DataCoercion$getBindingDefaultForCoercion(coercionType) {
  5930. switch (coercionType) {
  5931. case Microsoft.Office.WebExtension.CoercionType.Matrix: return Microsoft.Office.WebExtension.BindingType.Matrix;
  5932. case Microsoft.Office.WebExtension.CoercionType.Table: return Microsoft.Office.WebExtension.BindingType.Table;
  5933. case Microsoft.Office.WebExtension.CoercionType.Text:
  5934. case Microsoft.Office.WebExtension.CoercionType.Html:
  5935. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  5936. default:
  5937. return Microsoft.Office.WebExtension.BindingType.Text;
  5938. }
  5939. },
  5940. determineCoercionType: function OSF_DDA_DataCoercion$determineCoercionType(data) {
  5941. if (data==null || data==undefined)
  5942. return null;
  5943. var sourceType=null;
  5944. var runtimeType=typeof data;
  5945. if (data.rows !==undefined) {
  5946. sourceType=Microsoft.Office.WebExtension.CoercionType.Table;
  5947. }
  5948. else if (OSF.OUtil.isArray(data)) {
  5949. sourceType=Microsoft.Office.WebExtension.CoercionType.Matrix;
  5950. }
  5951. else if (runtimeType=="string" || runtimeType=="number" || runtimeType=="boolean" || OSF.OUtil.isDate(data)) {
  5952. sourceType=Microsoft.Office.WebExtension.CoercionType.Text;
  5953. }
  5954. else {
  5955. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject;
  5956. }
  5957. return sourceType;
  5958. },
  5959. coerceData: function OSF_DDA_DataCoercion$coerceData(data, destinationType, sourceType) {
  5960. sourceType=sourceType || OSF.DDA.DataCoercion.determineCoercionType(data);
  5961. if (sourceType && sourceType !=destinationType) {
  5962. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionBegin);
  5963. data=OSF.DDA.DataCoercion._coerceDataFromTable(destinationType, OSF.DDA.DataCoercion._coerceDataToTable(data, sourceType));
  5964. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionEnd);
  5965. }
  5966. return data;
  5967. },
  5968. _matrixToText: function OSF_DDA_DataCoercion$_matrixToText(matrix) {
  5969. if (matrix.length==1 && matrix[0].length==1)
  5970. return ""+matrix[0][0];
  5971. var val="";
  5972. for (var i=0; i < matrix.length; i++) {
  5973. val+=matrix[i].join("\t")+"\n";
  5974. }
  5975. return val.substring(0, val.length - 1);
  5976. },
  5977. _textToMatrix: function OSF_DDA_DataCoercion$_textToMatrix(text) {
  5978. var ret=text.split("\n");
  5979. for (var i=0; i < ret.length; i++)
  5980. ret[i]=ret[i].split("\t");
  5981. return ret;
  5982. },
  5983. _tableToText: function OSF_DDA_DataCoercion$_tableToText(table) {
  5984. var headers="";
  5985. if (table.headers !=null) {
  5986. headers=OSF.DDA.DataCoercion._matrixToText([table.headers])+"\n";
  5987. }
  5988. var rows=OSF.DDA.DataCoercion._matrixToText(table.rows);
  5989. if (rows=="") {
  5990. headers=headers.substring(0, headers.length - 1);
  5991. }
  5992. return headers+rows;
  5993. },
  5994. _tableToMatrix: function OSF_DDA_DataCoercion$_tableToMatrix(table) {
  5995. var matrix=table.rows;
  5996. if (table.headers !=null) {
  5997. matrix.unshift(table.headers);
  5998. }
  5999. return matrix;
  6000. },
  6001. _coerceDataFromTable: function OSF_DDA_DataCoercion$_coerceDataFromTable(coercionType, table) {
  6002. var value;
  6003. switch (coercionType) {
  6004. case Microsoft.Office.WebExtension.CoercionType.Table:
  6005. value=table;
  6006. break;
  6007. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  6008. value=OSF.DDA.DataCoercion._tableToMatrix(table);
  6009. break;
  6010. case Microsoft.Office.WebExtension.CoercionType.SlideRange:
  6011. value=null;
  6012. if (OSF.DDA.OMFactory.manufactureSlideRange) {
  6013. value=OSF.DDA.OMFactory.manufactureSlideRange(OSF.DDA.DataCoercion._tableToText(table));
  6014. }
  6015. if (value==null) {
  6016. value=OSF.DDA.DataCoercion._tableToText(table);
  6017. }
  6018. break;
  6019. case Microsoft.Office.WebExtension.CoercionType.Text:
  6020. case Microsoft.Office.WebExtension.CoercionType.Html:
  6021. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6022. default:
  6023. value=OSF.DDA.DataCoercion._tableToText(table);
  6024. break;
  6025. }
  6026. return value;
  6027. },
  6028. _coerceDataToTable: function OSF_DDA_DataCoercion$_coerceDataToTable(data, sourceType) {
  6029. if (sourceType==undefined) {
  6030. sourceType=OSF.DDA.DataCoercion.determineCoercionType(data);
  6031. }
  6032. var value;
  6033. switch (sourceType) {
  6034. case Microsoft.Office.WebExtension.CoercionType.Table:
  6035. value=data;
  6036. break;
  6037. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  6038. value=new Microsoft.Office.WebExtension.TableData(data);
  6039. break;
  6040. case Microsoft.Office.WebExtension.CoercionType.Text:
  6041. case Microsoft.Office.WebExtension.CoercionType.Html:
  6042. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6043. default:
  6044. value=new Microsoft.Office.WebExtension.TableData(OSF.DDA.DataCoercion._textToMatrix(data));
  6045. break;
  6046. }
  6047. return value;
  6048. }
  6049. };
  6050. })();
  6051. Microsoft.Office.WebExtension.EventType={};
  6052. OSF.EventDispatch=function OSF_EventDispatch(eventTypes) {
  6053. this._eventHandlers={};
  6054. this._queuedEventsArgs={};
  6055. for (var entry in eventTypes) {
  6056. var eventType=eventTypes[entry];
  6057. this._eventHandlers[eventType]=[];
  6058. this._queuedEventsArgs[eventType]=[];
  6059. }
  6060. };
  6061. OSF.EventDispatch.prototype={
  6062. getSupportedEvents: function OSF_EventDispatch$getSupportedEvents() {
  6063. var events=[];
  6064. for (var eventName in this._eventHandlers)
  6065. events.push(eventName);
  6066. return events;
  6067. },
  6068. supportsEvent: function OSF_EventDispatch$supportsEvent(event) {
  6069. var isSupported=false;
  6070. for (var eventName in this._eventHandlers) {
  6071. if (event==eventName) {
  6072. isSupported=true;
  6073. break;
  6074. }
  6075. }
  6076. return isSupported;
  6077. },
  6078. hasEventHandler: function OSF_EventDispatch$hasEventHandler(eventType, handler) {
  6079. var handlers=this._eventHandlers[eventType];
  6080. if (handlers && handlers.length > 0) {
  6081. for (var h in handlers) {
  6082. if (handlers[h]===handler)
  6083. return true;
  6084. }
  6085. }
  6086. return false;
  6087. },
  6088. addEventHandler: function OSF_EventDispatch$addEventHandler(eventType, handler) {
  6089. if (typeof handler !="function") {
  6090. return false;
  6091. }
  6092. var handlers=this._eventHandlers[eventType];
  6093. if (handlers && !this.hasEventHandler(eventType, handler)) {
  6094. handlers.push(handler);
  6095. return true;
  6096. }
  6097. else {
  6098. return false;
  6099. }
  6100. },
  6101. addEventHandlerAndFireQueuedEvent: function OSF_EventDispatch$addEventHandlerAndFireQueuedEvent(eventType, handler) {
  6102. var handlers=this._eventHandlers[eventType];
  6103. var isFirstHandler=handlers.length==0;
  6104. var succeed=this.addEventHandler(eventType, handler);
  6105. if (isFirstHandler && succeed) {
  6106. this.fireQueuedEvent(eventType);
  6107. }
  6108. return succeed;
  6109. },
  6110. removeEventHandler: function OSF_EventDispatch$removeEventHandler(eventType, handler) {
  6111. var handlers=this._eventHandlers[eventType];
  6112. if (handlers && handlers.length > 0) {
  6113. for (var index=0; index < handlers.length; index++) {
  6114. if (handlers[index]===handler) {
  6115. handlers.splice(index, 1);
  6116. return true;
  6117. }
  6118. }
  6119. }
  6120. return false;
  6121. },
  6122. clearEventHandlers: function OSF_EventDispatch$clearEventHandlers(eventType) {
  6123. if (typeof this._eventHandlers[eventType] !="undefined" && this._eventHandlers[eventType].length > 0) {
  6124. this._eventHandlers[eventType]=[];
  6125. return true;
  6126. }
  6127. return false;
  6128. },
  6129. getEventHandlerCount: function OSF_EventDispatch$getEventHandlerCount(eventType) {
  6130. return this._eventHandlers[eventType] !=undefined ? this._eventHandlers[eventType].length : -1;
  6131. },
  6132. fireEvent: function OSF_EventDispatch$fireEvent(eventArgs) {
  6133. if (eventArgs.type==undefined)
  6134. return false;
  6135. var eventType=eventArgs.type;
  6136. if (eventType && this._eventHandlers[eventType]) {
  6137. var eventHandlers=this._eventHandlers[eventType];
  6138. for (var handler in eventHandlers)
  6139. eventHandlers[handler](eventArgs);
  6140. return true;
  6141. }
  6142. else {
  6143. return false;
  6144. }
  6145. },
  6146. fireOrQueueEvent: function OSF_EventDispatch$fireOrQueueEvent(eventArgs) {
  6147. var eventType=eventArgs.type;
  6148. if (eventType && this._eventHandlers[eventType]) {
  6149. var eventHandlers=this._eventHandlers[eventType];
  6150. var queuedEvents=this._queuedEventsArgs[eventType];
  6151. if (eventHandlers.length==0) {
  6152. queuedEvents.push(eventArgs);
  6153. }
  6154. else {
  6155. this.fireEvent(eventArgs);
  6156. }
  6157. return true;
  6158. }
  6159. else {
  6160. return false;
  6161. }
  6162. },
  6163. fireQueuedEvent: function OSF_EventDispatch$queueEvent(eventType) {
  6164. if (eventType && this._eventHandlers[eventType]) {
  6165. var eventHandlers=this._eventHandlers[eventType];
  6166. var queuedEvents=this._queuedEventsArgs[eventType];
  6167. if (eventHandlers.length > 0) {
  6168. var eventHandler=eventHandlers[0];
  6169. while (queuedEvents.length > 0) {
  6170. var eventArgs=queuedEvents.shift();
  6171. eventHandler(eventArgs);
  6172. }
  6173. return true;
  6174. }
  6175. }
  6176. return false;
  6177. }
  6178. };
  6179. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6180. OSF.DDA.OMFactory.manufactureEventArgs=function OSF_DDA_OMFactory$manufactureEventArgs(eventType, target, eventProperties) {
  6181. var args;
  6182. switch (eventType) {
  6183. case Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged:
  6184. args=new OSF.DDA.DocumentSelectionChangedEventArgs(target);
  6185. break;
  6186. case Microsoft.Office.WebExtension.EventType.BindingSelectionChanged:
  6187. args=new OSF.DDA.BindingSelectionChangedEventArgs(this.manufactureBinding(eventProperties, target.document), eventProperties[OSF.DDA.PropertyDescriptors.Subset]);
  6188. break;
  6189. case Microsoft.Office.WebExtension.EventType.BindingDataChanged:
  6190. args=new OSF.DDA.BindingDataChangedEventArgs(this.manufactureBinding(eventProperties, target.document));
  6191. break;
  6192. case Microsoft.Office.WebExtension.EventType.SettingsChanged:
  6193. args=new OSF.DDA.SettingsChangedEventArgs(target);
  6194. break;
  6195. case Microsoft.Office.WebExtension.EventType.ActiveViewChanged:
  6196. args=new OSF.DDA.ActiveViewChangedEventArgs(eventProperties);
  6197. break;
  6198. case Microsoft.Office.WebExtension.EventType.OfficeThemeChanged:
  6199. args=new OSF.DDA.Theming.OfficeThemeChangedEventArgs(eventProperties);
  6200. break;
  6201. case Microsoft.Office.WebExtension.EventType.DocumentThemeChanged:
  6202. args=new OSF.DDA.Theming.DocumentThemeChangedEventArgs(eventProperties);
  6203. break;
  6204. case Microsoft.Office.WebExtension.EventType.AppCommandInvoked:
  6205. args=OSF.DDA.AppCommand.AppCommandInvokedEventArgs.create(eventProperties);
  6206. break;
  6207. case Microsoft.Office.WebExtension.EventType.DataNodeInserted:
  6208. args=new OSF.DDA.NodeInsertedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  6209. break;
  6210. case Microsoft.Office.WebExtension.EventType.DataNodeReplaced:
  6211. args=new OSF.DDA.NodeReplacedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  6212. break;
  6213. case Microsoft.Office.WebExtension.EventType.DataNodeDeleted:
  6214. args=new OSF.DDA.NodeDeletedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NextSiblingNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  6215. break;
  6216. case Microsoft.Office.WebExtension.EventType.TaskSelectionChanged:
  6217. args=new OSF.DDA.TaskSelectionChangedEventArgs(target);
  6218. break;
  6219. case Microsoft.Office.WebExtension.EventType.ResourceSelectionChanged:
  6220. args=new OSF.DDA.ResourceSelectionChangedEventArgs(target);
  6221. break;
  6222. case Microsoft.Office.WebExtension.EventType.ViewSelectionChanged:
  6223. args=new OSF.DDA.ViewSelectionChangedEventArgs(target);
  6224. break;
  6225. case Microsoft.Office.WebExtension.EventType.DialogMessageReceived:
  6226. args=new OSF.DDA.DialogEventArgs(eventProperties);
  6227. break;
  6228. case Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived:
  6229. args=new OSF.DDA.DialogParentEventArgs(eventProperties);
  6230. break;
  6231. case Microsoft.Office.WebExtension.EventType.ItemChanged:
  6232. if (OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlook" || OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlookwebapp") {
  6233. args=new OSF.DDA.OlkItemSelectedChangedEventArgs(eventProperties);
  6234. target.initialize(args["initialData"]);
  6235. target.setCurrentItemNumber(args["itemNumber"].itemNumber);
  6236. }
  6237. else {
  6238. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  6239. }
  6240. break;
  6241. default:
  6242. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  6243. }
  6244. return args;
  6245. };
  6246. OSF.DDA.AsyncMethodNames.addNames({
  6247. AddHandlerAsync: "addHandlerAsync",
  6248. RemoveHandlerAsync: "removeHandlerAsync"
  6249. });
  6250. OSF.DDA.AsyncMethodCalls.define({
  6251. method: OSF.DDA.AsyncMethodNames.AddHandlerAsync,
  6252. requiredArguments: [{
  6253. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  6254. "enum": Microsoft.Office.WebExtension.EventType,
  6255. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  6256. },
  6257. {
  6258. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  6259. "types": ["function"]
  6260. }
  6261. ],
  6262. supportedOptions: [],
  6263. privateStateCallbacks: []
  6264. });
  6265. OSF.DDA.AsyncMethodCalls.define({
  6266. method: OSF.DDA.AsyncMethodNames.RemoveHandlerAsync,
  6267. requiredArguments: [
  6268. {
  6269. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  6270. "enum": Microsoft.Office.WebExtension.EventType,
  6271. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  6272. }
  6273. ],
  6274. supportedOptions: [
  6275. {
  6276. name: Microsoft.Office.WebExtension.Parameters.Handler,
  6277. value: {
  6278. "types": ["function", "object"],
  6279. "defaultValue": null
  6280. }
  6281. }
  6282. ],
  6283. privateStateCallbacks: []
  6284. });
  6285. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  6286. DialogParentMessageReceivedEvent: "DialogParentMessageReceivedEvent"
  6287. });
  6288. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  6289. DialogParentMessageReceived: "dialogParentMessageReceived",
  6290. DialogParentEventReceived: "dialogParentEventReceived"
  6291. });
  6292. OSF.DialogParentMessageEventDispatch=new OSF.EventDispatch([
  6293. Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived,
  6294. Microsoft.Office.WebExtension.EventType.DialogParentEventReceived
  6295. ]);
  6296. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Image: "image" });
  6297. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Ooxml: "ooxml" });
  6298. OSF.DDA.DataPartProperties={
  6299. Id: Microsoft.Office.WebExtension.Parameters.Id,
  6300. BuiltIn: "DataPartBuiltIn"
  6301. };
  6302. OSF.DDA.DataNodeProperties={
  6303. Handle: "DataNodeHandle",
  6304. BaseName: "DataNodeBaseName",
  6305. NamespaceUri: "DataNodeNamespaceUri",
  6306. NodeType: "DataNodeType"
  6307. };
  6308. OSF.DDA.DataNodeEventProperties={
  6309. OldNode: "OldNode",
  6310. NewNode: "NewNode",
  6311. NextSiblingNode: "NextSiblingNode",
  6312. InUndoRedo: "InUndoRedo"
  6313. };
  6314. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  6315. DataPartProperties: "DataPartProperties",
  6316. DataNodeProperties: "DataNodeProperties"
  6317. });
  6318. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, {
  6319. DataPartList: "DataPartList",
  6320. DataNodeList: "DataNodeList"
  6321. });
  6322. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataPartList, OSF.DDA.PropertyDescriptors.DataPartProperties);
  6323. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataNodeList, OSF.DDA.PropertyDescriptors.DataNodeProperties);
  6324. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  6325. DataNodeInsertedEvent: "DataNodeInsertedEvent",
  6326. DataNodeReplacedEvent: "DataNodeReplacedEvent",
  6327. DataNodeDeletedEvent: "DataNodeDeletedEvent"
  6328. });
  6329. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  6330. DataNodeDeleted: "nodeDeleted",
  6331. DataNodeInserted: "nodeInserted",
  6332. DataNodeReplaced: "nodeReplaced"
  6333. });
  6334. OSF.DDA.CustomXmlParts=function OSF_DDA_CustomXmlParts() {
  6335. this._eventDispatches=[];
  6336. var am=OSF.DDA.AsyncMethodNames;
  6337. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6338. am.AddDataPartAsync,
  6339. am.GetDataPartByIdAsync,
  6340. am.GetDataPartsByNameSpaceAsync
  6341. ]);
  6342. };
  6343. OSF.DDA.CustomXmlPart=function OSF_DDA_CustomXmlPart(customXmlParts, id, builtIn) {
  6344. OSF.OUtil.defineEnumerableProperties(this, {
  6345. "builtIn": {
  6346. value: builtIn
  6347. },
  6348. "id": {
  6349. value: id
  6350. },
  6351. "namespaceManager": {
  6352. value: new OSF.DDA.CustomXmlPrefixMappings(id)
  6353. }
  6354. });
  6355. var am=OSF.DDA.AsyncMethodNames;
  6356. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6357. am.DeleteDataPartAsync,
  6358. am.GetPartNodesAsync,
  6359. am.GetPartXmlAsync
  6360. ]);
  6361. var customXmlPartEventDispatches=customXmlParts._eventDispatches;
  6362. var dispatch=customXmlPartEventDispatches[id];
  6363. if (!dispatch) {
  6364. var et=Microsoft.Office.WebExtension.EventType;
  6365. dispatch=new OSF.EventDispatch([
  6366. et.DataNodeDeleted,
  6367. et.DataNodeInserted,
  6368. et.DataNodeReplaced
  6369. ]);
  6370. customXmlPartEventDispatches[id]=dispatch;
  6371. }
  6372. OSF.DDA.DispIdHost.addEventSupport(this, dispatch);
  6373. };
  6374. OSF.DDA.CustomXmlPrefixMappings=function OSF_DDA_CustomXmlPrefixMappings(partId) {
  6375. var am=OSF.DDA.AsyncMethodNames;
  6376. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6377. am.AddDataPartNamespaceAsync,
  6378. am.GetDataPartNamespaceAsync,
  6379. am.GetDataPartPrefixAsync
  6380. ], partId);
  6381. };
  6382. OSF.DDA.CustomXmlNode=function OSF_DDA_CustomXmlNode(handle, nodeType, ns, baseName) {
  6383. OSF.OUtil.defineEnumerableProperties(this, {
  6384. "baseName": {
  6385. value: baseName
  6386. },
  6387. "namespaceUri": {
  6388. value: ns
  6389. },
  6390. "nodeType": {
  6391. value: nodeType
  6392. }
  6393. });
  6394. var am=OSF.DDA.AsyncMethodNames;
  6395. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6396. am.GetRelativeNodesAsync,
  6397. am.GetNodeValueAsync,
  6398. am.GetNodeXmlAsync,
  6399. am.SetNodeValueAsync,
  6400. am.SetNodeXmlAsync,
  6401. am.GetNodeTextAsync,
  6402. am.SetNodeTextAsync
  6403. ], handle);
  6404. };
  6405. OSF.DDA.NodeInsertedEventArgs=function OSF_DDA_NodeInsertedEventArgs(newNode, inUndoRedo) {
  6406. OSF.OUtil.defineEnumerableProperties(this, {
  6407. "type": {
  6408. value: Microsoft.Office.WebExtension.EventType.DataNodeInserted
  6409. },
  6410. "newNode": {
  6411. value: newNode
  6412. },
  6413. "inUndoRedo": {
  6414. value: inUndoRedo
  6415. }
  6416. });
  6417. };
  6418. OSF.DDA.NodeReplacedEventArgs=function OSF_DDA_NodeReplacedEventArgs(oldNode, newNode, inUndoRedo) {
  6419. OSF.OUtil.defineEnumerableProperties(this, {
  6420. "type": {
  6421. value: Microsoft.Office.WebExtension.EventType.DataNodeReplaced
  6422. },
  6423. "oldNode": {
  6424. value: oldNode
  6425. },
  6426. "newNode": {
  6427. value: newNode
  6428. },
  6429. "inUndoRedo": {
  6430. value: inUndoRedo
  6431. }
  6432. });
  6433. };
  6434. OSF.DDA.NodeDeletedEventArgs=function OSF_DDA_NodeDeletedEventArgs(oldNode, oldNextSibling, inUndoRedo) {
  6435. OSF.OUtil.defineEnumerableProperties(this, {
  6436. "type": {
  6437. value: Microsoft.Office.WebExtension.EventType.DataNodeDeleted
  6438. },
  6439. "oldNode": {
  6440. value: oldNode
  6441. },
  6442. "oldNextSibling": {
  6443. value: oldNextSibling
  6444. },
  6445. "inUndoRedo": {
  6446. value: inUndoRedo
  6447. }
  6448. });
  6449. };
  6450. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6451. OSF.DDA.OMFactory.manufactureDataNode=function OSF_DDA_OMFactory$manufactureDataNode(nodeProperties) {
  6452. if (nodeProperties) {
  6453. return new OSF.DDA.CustomXmlNode(nodeProperties[OSF.DDA.DataNodeProperties.Handle], nodeProperties[OSF.DDA.DataNodeProperties.NodeType], nodeProperties[OSF.DDA.DataNodeProperties.NamespaceUri], nodeProperties[OSF.DDA.DataNodeProperties.BaseName]);
  6454. }
  6455. };
  6456. OSF.DDA.OMFactory.manufactureDataPart=function OSF_DDA_OMFactory$manufactureDataPart(partProperties, containingCustomXmlParts) {
  6457. return new OSF.DDA.CustomXmlPart(containingCustomXmlParts, partProperties[OSF.DDA.DataPartProperties.Id], partProperties[OSF.DDA.DataPartProperties.BuiltIn]);
  6458. };
  6459. OSF.DDA.AsyncMethodNames.addNames({
  6460. AddDataPartAsync: "addAsync",
  6461. GetDataPartByIdAsync: "getByIdAsync",
  6462. GetDataPartsByNameSpaceAsync: "getByNamespaceAsync",
  6463. DeleteDataPartAsync: "deleteAsync",
  6464. GetPartNodesAsync: "getNodesAsync",
  6465. GetPartXmlAsync: "getXmlAsync",
  6466. AddDataPartNamespaceAsync: "addNamespaceAsync",
  6467. GetDataPartNamespaceAsync: "getNamespaceAsync",
  6468. GetDataPartPrefixAsync: "getPrefixAsync",
  6469. GetRelativeNodesAsync: "getNodesAsync",
  6470. GetNodeValueAsync: "getNodeValueAsync",
  6471. GetNodeXmlAsync: "getXmlAsync",
  6472. SetNodeValueAsync: "setNodeValueAsync",
  6473. SetNodeXmlAsync: "setXmlAsync",
  6474. GetNodeTextAsync: "getTextAsync",
  6475. SetNodeTextAsync: "setTextAsync"
  6476. });
  6477. (function () {
  6478. function processDataPart(dataPartDescriptor) {
  6479. return OSF.DDA.OMFactory.manufactureDataPart(dataPartDescriptor, Microsoft.Office.WebExtension.context.document.customXmlParts);
  6480. }
  6481. function processDataNode(dataNodeDescriptor) {
  6482. return OSF.DDA.OMFactory.manufactureDataNode(dataNodeDescriptor);
  6483. }
  6484. function processData(dataDescriptor, caller, callArgs) {
  6485. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  6486. return data==undefined ? null : data;
  6487. }
  6488. function getObjectId(obj) { return obj.id; }
  6489. function getPartId(part, partId) { return partId; }
  6490. ;
  6491. function getNodeHandle(node, nodeHandle) { return nodeHandle; }
  6492. ;
  6493. OSF.DDA.AsyncMethodCalls.define({
  6494. method: OSF.DDA.AsyncMethodNames.AddDataPartAsync,
  6495. requiredArguments: [
  6496. {
  6497. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  6498. "types": ["string"]
  6499. }
  6500. ],
  6501. supportedOptions: [],
  6502. privateStateCallbacks: [],
  6503. onSucceeded: processDataPart
  6504. });
  6505. OSF.DDA.AsyncMethodCalls.define({
  6506. method: OSF.DDA.AsyncMethodNames.GetDataPartByIdAsync,
  6507. requiredArguments: [
  6508. {
  6509. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6510. "types": ["string"]
  6511. }
  6512. ],
  6513. supportedOptions: [],
  6514. privateStateCallbacks: [],
  6515. onSucceeded: processDataPart
  6516. });
  6517. OSF.DDA.AsyncMethodCalls.define({
  6518. method: OSF.DDA.AsyncMethodNames.GetDataPartsByNameSpaceAsync,
  6519. requiredArguments: [
  6520. {
  6521. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  6522. "types": ["string"]
  6523. }
  6524. ],
  6525. supportedOptions: [],
  6526. privateStateCallbacks: [],
  6527. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataPartList], processDataPart); }
  6528. });
  6529. OSF.DDA.AsyncMethodCalls.define({
  6530. method: OSF.DDA.AsyncMethodNames.DeleteDataPartAsync,
  6531. requiredArguments: [],
  6532. supportedOptions: [],
  6533. privateStateCallbacks: [
  6534. {
  6535. name: OSF.DDA.DataPartProperties.Id,
  6536. value: getObjectId
  6537. }
  6538. ]
  6539. });
  6540. OSF.DDA.AsyncMethodCalls.define({
  6541. method: OSF.DDA.AsyncMethodNames.GetPartNodesAsync,
  6542. requiredArguments: [
  6543. {
  6544. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  6545. "types": ["string"]
  6546. }
  6547. ],
  6548. supportedOptions: [],
  6549. privateStateCallbacks: [
  6550. {
  6551. name: OSF.DDA.DataPartProperties.Id,
  6552. value: getObjectId
  6553. }
  6554. ],
  6555. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  6556. });
  6557. OSF.DDA.AsyncMethodCalls.define({
  6558. method: OSF.DDA.AsyncMethodNames.GetPartXmlAsync,
  6559. requiredArguments: [],
  6560. supportedOptions: [],
  6561. privateStateCallbacks: [
  6562. {
  6563. name: OSF.DDA.DataPartProperties.Id,
  6564. value: getObjectId
  6565. }
  6566. ],
  6567. onSucceeded: processData
  6568. });
  6569. OSF.DDA.AsyncMethodCalls.define({
  6570. method: OSF.DDA.AsyncMethodNames.AddDataPartNamespaceAsync,
  6571. requiredArguments: [
  6572. {
  6573. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  6574. "types": ["string"]
  6575. },
  6576. {
  6577. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  6578. "types": ["string"]
  6579. }
  6580. ],
  6581. supportedOptions: [],
  6582. privateStateCallbacks: [
  6583. {
  6584. name: OSF.DDA.DataPartProperties.Id,
  6585. value: getPartId
  6586. }
  6587. ]
  6588. });
  6589. OSF.DDA.AsyncMethodCalls.define({
  6590. method: OSF.DDA.AsyncMethodNames.GetDataPartNamespaceAsync,
  6591. requiredArguments: [
  6592. {
  6593. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  6594. "types": ["string"]
  6595. }
  6596. ],
  6597. supportedOptions: [],
  6598. privateStateCallbacks: [
  6599. {
  6600. name: OSF.DDA.DataPartProperties.Id,
  6601. value: getPartId
  6602. }
  6603. ],
  6604. onSucceeded: processData
  6605. });
  6606. OSF.DDA.AsyncMethodCalls.define({
  6607. method: OSF.DDA.AsyncMethodNames.GetDataPartPrefixAsync,
  6608. requiredArguments: [
  6609. {
  6610. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  6611. "types": ["string"]
  6612. }
  6613. ],
  6614. supportedOptions: [],
  6615. privateStateCallbacks: [
  6616. {
  6617. name: OSF.DDA.DataPartProperties.Id,
  6618. value: getPartId
  6619. }
  6620. ],
  6621. onSucceeded: processData
  6622. });
  6623. OSF.DDA.AsyncMethodCalls.define({
  6624. method: OSF.DDA.AsyncMethodNames.GetRelativeNodesAsync,
  6625. requiredArguments: [
  6626. {
  6627. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  6628. "types": ["string"]
  6629. }
  6630. ],
  6631. supportedOptions: [],
  6632. privateStateCallbacks: [
  6633. {
  6634. name: OSF.DDA.DataNodeProperties.Handle,
  6635. value: getNodeHandle
  6636. }
  6637. ],
  6638. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  6639. });
  6640. OSF.DDA.AsyncMethodCalls.define({
  6641. method: OSF.DDA.AsyncMethodNames.GetNodeValueAsync,
  6642. requiredArguments: [],
  6643. supportedOptions: [],
  6644. privateStateCallbacks: [
  6645. {
  6646. name: OSF.DDA.DataNodeProperties.Handle,
  6647. value: getNodeHandle
  6648. }
  6649. ],
  6650. onSucceeded: processData
  6651. });
  6652. OSF.DDA.AsyncMethodCalls.define({
  6653. method: OSF.DDA.AsyncMethodNames.GetNodeXmlAsync,
  6654. requiredArguments: [],
  6655. supportedOptions: [],
  6656. privateStateCallbacks: [
  6657. {
  6658. name: OSF.DDA.DataNodeProperties.Handle,
  6659. value: getNodeHandle
  6660. }
  6661. ],
  6662. onSucceeded: processData
  6663. });
  6664. OSF.DDA.AsyncMethodCalls.define({
  6665. method: OSF.DDA.AsyncMethodNames.SetNodeValueAsync,
  6666. requiredArguments: [
  6667. {
  6668. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6669. "types": ["string"]
  6670. }
  6671. ],
  6672. supportedOptions: [],
  6673. privateStateCallbacks: [
  6674. {
  6675. name: OSF.DDA.DataNodeProperties.Handle,
  6676. value: getNodeHandle
  6677. }
  6678. ]
  6679. });
  6680. OSF.DDA.AsyncMethodCalls.define({
  6681. method: OSF.DDA.AsyncMethodNames.SetNodeXmlAsync,
  6682. requiredArguments: [
  6683. {
  6684. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  6685. "types": ["string"]
  6686. }
  6687. ],
  6688. supportedOptions: [],
  6689. privateStateCallbacks: [
  6690. {
  6691. name: OSF.DDA.DataNodeProperties.Handle,
  6692. value: getNodeHandle
  6693. }
  6694. ]
  6695. });
  6696. OSF.DDA.AsyncMethodCalls.define({
  6697. method: OSF.DDA.AsyncMethodNames.GetNodeTextAsync,
  6698. requiredArguments: [],
  6699. supportedOptions: [],
  6700. privateStateCallbacks: [
  6701. {
  6702. name: OSF.DDA.DataNodeProperties.Handle,
  6703. value: getNodeHandle
  6704. }
  6705. ],
  6706. onSucceeded: processData
  6707. });
  6708. OSF.DDA.AsyncMethodCalls.define({
  6709. method: OSF.DDA.AsyncMethodNames.SetNodeTextAsync,
  6710. requiredArguments: [
  6711. {
  6712. "name": Microsoft.Office.WebExtension.Parameters.Text,
  6713. "types": ["string"]
  6714. }
  6715. ],
  6716. supportedOptions: [],
  6717. privateStateCallbacks: [
  6718. {
  6719. name: OSF.DDA.DataNodeProperties.Handle,
  6720. value: getNodeHandle
  6721. }
  6722. ]
  6723. });
  6724. })();
  6725. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  6726. OSF.DDA.Marshaling.CustomXmlPartsKeys={
  6727. Id: "id",
  6728. Namespace: "namespace",
  6729. Xml: "xml",
  6730. XPath: "xpath",
  6731. Prefix: "prefix"
  6732. };
  6733. OSF.DDA.Marshaling.DataPartProperties={
  6734. Id: "id",
  6735. BuiltIn: "DataPartBuiltIn"
  6736. };
  6737. OSF.DDA.Marshaling.PropertyDescriptors={
  6738. DataPartProperties: "DataPartProperties",
  6739. DataNodeProperties: "DataNodeProperties"
  6740. };
  6741. OSF.DDA.Marshaling.DataNodeProperties={
  6742. Handle: "DataNodeHandle",
  6743. BaseName: "DataNodeBaseName",
  6744. NamespaceUri: "DataNodeNamespaceUri",
  6745. NodeType: "DataNodeType"
  6746. };
  6747. OSF.DDA.Marshaling.ListDescriptors={
  6748. DataPartList: "DataPartList",
  6749. DataNodeList: "DataNodeList"
  6750. };
  6751. OSF.DDA.Marshaling.DataNodeEventProperties={
  6752. OldNode: "OldNode",
  6753. NewNode: "NewNode",
  6754. NextSiblingNode: "NextSiblingNode",
  6755. InUndoRedo: "InUndoRedo"
  6756. };
  6757. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6758. type: OSF.DDA.PropertyDescriptors.DataPartProperties,
  6759. fromHost: [
  6760. { name: OSF.DDA.DataPartProperties.Id, value: OSF.DDA.Marshaling.DataPartProperties.Id },
  6761. { name: OSF.DDA.DataPartProperties.BuiltIn, value: OSF.DDA.Marshaling.DataPartProperties.BuiltIn }
  6762. ],
  6763. isComplexType: true
  6764. });
  6765. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6766. type: OSF.DDA.PropertyDescriptors.DataNodeProperties,
  6767. fromHost: [
  6768. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle },
  6769. { name: OSF.DDA.DataNodeProperties.BaseName, value: OSF.DDA.Marshaling.DataNodeProperties.BaseName },
  6770. { name: OSF.DDA.DataNodeProperties.NamespaceUri, value: OSF.DDA.Marshaling.DataNodeProperties.NamespaceUri },
  6771. { name: OSF.DDA.DataNodeProperties.NodeType, value: OSF.DDA.Marshaling.DataNodeProperties.NodeType }
  6772. ],
  6773. isComplexType: true
  6774. });
  6775. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6776. type: OSF.DDA.EventDescriptors.DataNodeInsertedEvent,
  6777. fromHost: [
  6778. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: OSF.DDA.Marshaling.DataNodeEventProperties.InUndoRedo },
  6779. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: OSF.DDA.Marshaling.DataNodeEventProperties.NewNode }
  6780. ],
  6781. isComplexType: true
  6782. });
  6783. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6784. type: OSF.DDA.EventDescriptors.DataNodeReplacedEvent,
  6785. fromHost: [
  6786. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: OSF.DDA.Marshaling.DataNodeEventProperties.InUndoRedo },
  6787. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: OSF.DDA.Marshaling.DataNodeEventProperties.OldNode },
  6788. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: OSF.DDA.Marshaling.DataNodeEventProperties.NewNode }
  6789. ],
  6790. isComplexType: true
  6791. });
  6792. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6793. type: OSF.DDA.EventDescriptors.DataNodeDeletedEvent,
  6794. fromHost: [
  6795. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: OSF.DDA.Marshaling.DataNodeEventProperties.InUndoRedo },
  6796. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: OSF.DDA.Marshaling.DataNodeEventProperties.OldNode },
  6797. { name: OSF.DDA.DataNodeEventProperties.NextSiblingNode, value: OSF.DDA.Marshaling.DataNodeEventProperties.NextSiblingNode }
  6798. ],
  6799. isComplexType: true
  6800. });
  6801. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6802. type: OSF.DDA.DataNodeEventProperties.OldNode,
  6803. fromHost: [
  6804. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  6805. ],
  6806. isComplexType: true
  6807. });
  6808. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6809. type: OSF.DDA.DataNodeEventProperties.NewNode,
  6810. fromHost: [
  6811. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  6812. ],
  6813. isComplexType: true
  6814. });
  6815. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6816. type: OSF.DDA.DataNodeEventProperties.NextSiblingNode,
  6817. fromHost: [
  6818. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  6819. ],
  6820. isComplexType: true
  6821. });
  6822. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6823. type: OSF.DDA.MethodDispId.dispidAddDataPartMethod,
  6824. fromHost: [
  6825. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.Marshaling.PropertyDescriptors.DataPartProperties }
  6826. ],
  6827. toHost: [
  6828. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Xml }
  6829. ]
  6830. });
  6831. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6832. type: OSF.DDA.MethodDispId.dispidGetDataPartByIdMethod,
  6833. fromHost: [
  6834. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.Marshaling.PropertyDescriptors.DataPartProperties }
  6835. ],
  6836. toHost: [
  6837. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Id }
  6838. ]
  6839. });
  6840. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6841. type: OSF.DDA.MethodDispId.dispidGetDataPartsByNamespaceMethod,
  6842. fromHost: [
  6843. { name: OSF.DDA.ListDescriptors.DataPartList, value: OSF.DDA.Marshaling.ListDescriptors.DataPartList }
  6844. ],
  6845. toHost: [
  6846. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Namespace }
  6847. ]
  6848. });
  6849. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6850. type: OSF.DDA.MethodDispId.dispidGetDataPartXmlMethod,
  6851. fromHost: [
  6852. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6853. ],
  6854. toHost: [
  6855. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Id }
  6856. ]
  6857. });
  6858. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6859. type: OSF.DDA.MethodDispId.dispidGetDataPartNodesMethod,
  6860. fromHost: [
  6861. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.Marshaling.ListDescriptors.DataNodeList }
  6862. ],
  6863. toHost: [
  6864. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Id },
  6865. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.XPath }
  6866. ]
  6867. });
  6868. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6869. type: OSF.DDA.MethodDispId.dispidDeleteDataPartMethod,
  6870. toHost: [
  6871. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Id }
  6872. ]
  6873. });
  6874. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6875. type: OSF.DDA.MethodDispId.dispidGetDataNodeValueMethod,
  6876. fromHost: [
  6877. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6878. ],
  6879. toHost: [
  6880. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle }
  6881. ]
  6882. });
  6883. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6884. type: OSF.DDA.MethodDispId.dispidGetDataNodeXmlMethod,
  6885. fromHost: [
  6886. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6887. ],
  6888. toHost: [
  6889. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle }
  6890. ]
  6891. });
  6892. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6893. type: OSF.DDA.MethodDispId.dispidGetDataNodeTextMethod,
  6894. fromHost: [
  6895. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6896. ],
  6897. toHost: [
  6898. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle }
  6899. ]
  6900. });
  6901. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6902. type: OSF.DDA.MethodDispId.dispidGetDataNodesMethod,
  6903. fromHost: [
  6904. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.Marshaling.ListDescriptors.DataNodeList }
  6905. ],
  6906. toHost: [
  6907. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle },
  6908. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.XPath }
  6909. ]
  6910. });
  6911. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6912. type: OSF.DDA.MethodDispId.dispidSetDataNodeValueMethod,
  6913. toHost: [
  6914. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle },
  6915. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6916. ]
  6917. });
  6918. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6919. type: OSF.DDA.MethodDispId.dispidSetDataNodeXmlMethod,
  6920. toHost: [
  6921. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle },
  6922. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Xml }
  6923. ]
  6924. });
  6925. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6926. type: OSF.DDA.MethodDispId.dispidSetDataNodeTextMethod,
  6927. toHost: [
  6928. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle },
  6929. { name: Microsoft.Office.WebExtension.Parameters.Text, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Text }
  6930. ]
  6931. });
  6932. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6933. type: OSF.DDA.MethodDispId.dispidAddDataNamespaceMethod,
  6934. toHost: [
  6935. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.DataPartProperties.Id },
  6936. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Prefix },
  6937. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Namespace }
  6938. ]
  6939. });
  6940. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6941. type: OSF.DDA.MethodDispId.dispidGetDataUriByPrefixMethod,
  6942. fromHost: [
  6943. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6944. ],
  6945. toHost: [
  6946. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.DataPartProperties.Id },
  6947. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Prefix }
  6948. ]
  6949. });
  6950. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6951. type: OSF.DDA.MethodDispId.dispidGetDataPrefixByUriMethod,
  6952. fromHost: [
  6953. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6954. ],
  6955. toHost: [
  6956. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.DataPartProperties.Id },
  6957. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Namespace }
  6958. ]
  6959. });
  6960. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6961. type: OSF.DDA.EventDispId.dispidDataNodeAddedEvent,
  6962. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeInsertedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }]
  6963. });
  6964. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6965. type: OSF.DDA.EventDispId.dispidDataNodeReplacedEvent,
  6966. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeReplacedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }]
  6967. });
  6968. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6969. type: OSF.DDA.EventDispId.dispidDataNodeDeletedEvent,
  6970. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeDeletedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }]
  6971. });
  6972. OSF.DDA.AsyncMethodNames.addNames({
  6973. GetSelectedDataAsync: "getSelectedDataAsync",
  6974. SetSelectedDataAsync: "setSelectedDataAsync"
  6975. });
  6976. (function () {
  6977. function processData(dataDescriptor, caller, callArgs) {
  6978. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  6979. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  6980. data=OSF.DDA.OMFactory.manufactureTableData(data);
  6981. }
  6982. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  6983. return data==undefined ? null : data;
  6984. }
  6985. OSF.DDA.AsyncMethodCalls.define({
  6986. method: OSF.DDA.AsyncMethodNames.GetSelectedDataAsync,
  6987. requiredArguments: [
  6988. {
  6989. "name": Microsoft.Office.WebExtension.Parameters.CoercionType,
  6990. "enum": Microsoft.Office.WebExtension.CoercionType
  6991. }
  6992. ],
  6993. supportedOptions: [
  6994. {
  6995. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  6996. value: {
  6997. "enum": Microsoft.Office.WebExtension.ValueFormat,
  6998. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  6999. }
  7000. },
  7001. {
  7002. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  7003. value: {
  7004. "enum": Microsoft.Office.WebExtension.FilterType,
  7005. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  7006. }
  7007. }
  7008. ],
  7009. privateStateCallbacks: [],
  7010. onSucceeded: processData
  7011. });
  7012. OSF.DDA.AsyncMethodCalls.define({
  7013. method: OSF.DDA.AsyncMethodNames.SetSelectedDataAsync,
  7014. requiredArguments: [
  7015. {
  7016. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7017. "types": ["string", "object", "number", "boolean"]
  7018. }
  7019. ],
  7020. supportedOptions: [
  7021. {
  7022. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7023. value: {
  7024. "enum": Microsoft.Office.WebExtension.CoercionType,
  7025. "calculate": function (requiredArgs) {
  7026. return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]);
  7027. }
  7028. }
  7029. },
  7030. {
  7031. name: Microsoft.Office.WebExtension.Parameters.ImageLeft,
  7032. value: {
  7033. "types": ["number", "boolean"],
  7034. "defaultValue": false
  7035. }
  7036. },
  7037. {
  7038. name: Microsoft.Office.WebExtension.Parameters.ImageTop,
  7039. value: {
  7040. "types": ["number", "boolean"],
  7041. "defaultValue": false
  7042. }
  7043. },
  7044. {
  7045. name: Microsoft.Office.WebExtension.Parameters.ImageWidth,
  7046. value: {
  7047. "types": ["number", "boolean"],
  7048. "defaultValue": false
  7049. }
  7050. },
  7051. {
  7052. name: Microsoft.Office.WebExtension.Parameters.ImageHeight,
  7053. value: {
  7054. "types": ["number", "boolean"],
  7055. "defaultValue": false
  7056. }
  7057. }
  7058. ],
  7059. privateStateCallbacks: []
  7060. });
  7061. })();
  7062. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7063. type: OSF.DDA.WAC.UniqueArguments.GetData,
  7064. toHost: [
  7065. { name: Microsoft.Office.WebExtension.Parameters.Id, value: "BindingId" },
  7066. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: "CoerceType" },
  7067. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: "ValueFormat" },
  7068. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: "FilterType" },
  7069. { name: Microsoft.Office.WebExtension.Parameters.Rows, value: "Rows" },
  7070. { name: Microsoft.Office.WebExtension.Parameters.Columns, value: "Columns" },
  7071. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: "StartRow" },
  7072. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: "StartCol" },
  7073. { name: Microsoft.Office.WebExtension.Parameters.RowCount, value: "RowCount" },
  7074. { name: Microsoft.Office.WebExtension.Parameters.ColumnCount, value: "ColCount" }
  7075. ]
  7076. });
  7077. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7078. type: OSF.DDA.WAC.UniqueArguments.SetData,
  7079. toHost: [
  7080. { name: Microsoft.Office.WebExtension.Parameters.Id, value: "BindingId" },
  7081. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: "CoerceType" },
  7082. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data },
  7083. { name: Microsoft.Office.WebExtension.Parameters.Rows, value: "Rows" },
  7084. { name: Microsoft.Office.WebExtension.Parameters.Columns, value: "Columns" },
  7085. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: "StartRow" },
  7086. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: "StartCol" },
  7087. { name: Microsoft.Office.WebExtension.Parameters.ImageLeft, value: "ImageLeft" },
  7088. { name: Microsoft.Office.WebExtension.Parameters.ImageTop, value: "ImageTop" },
  7089. { name: Microsoft.Office.WebExtension.Parameters.ImageWidth, value: "ImageWidth" },
  7090. { name: Microsoft.Office.WebExtension.Parameters.ImageHeight, value: "ImageHeight" }
  7091. ]
  7092. });
  7093. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7094. type: OSF.DDA.MethodDispId.dispidGetSelectedDataMethod,
  7095. fromHost: [
  7096. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  7097. ],
  7098. toHost: [
  7099. { name: OSF.DDA.WAC.UniqueArguments.GetData, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  7100. ]
  7101. });
  7102. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7103. type: OSF.DDA.MethodDispId.dispidSetSelectedDataMethod,
  7104. toHost: [
  7105. { name: OSF.DDA.WAC.UniqueArguments.SetData, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  7106. ]
  7107. });
  7108. OSF.DDA.SettingsManager={
  7109. SerializedSettings: "serializedSettings",
  7110. RefreshingSettings: "refreshingSettings",
  7111. DateJSONPrefix: "Date(",
  7112. DataJSONSuffix: ")",
  7113. serializeSettings: function OSF_DDA_SettingsManager$serializeSettings(settingsCollection) {
  7114. var ret={};
  7115. for (var key in settingsCollection) {
  7116. var value=settingsCollection[key];
  7117. try {
  7118. if (JSON) {
  7119. value=JSON.stringify(value, function dateReplacer(k, v) {
  7120. return OSF.OUtil.isDate(this[k]) ? OSF.DDA.SettingsManager.DateJSONPrefix+this[k].getTime()+OSF.DDA.SettingsManager.DataJSONSuffix : v;
  7121. });
  7122. }
  7123. else {
  7124. value=Sys.Serialization.JavaScriptSerializer.serialize(value);
  7125. }
  7126. ret[key]=value;
  7127. }
  7128. catch (ex) {
  7129. }
  7130. }
  7131. return ret;
  7132. },
  7133. deserializeSettings: function OSF_DDA_SettingsManager$deserializeSettings(serializedSettings) {
  7134. var ret={};
  7135. serializedSettings=serializedSettings || {};
  7136. for (var key in serializedSettings) {
  7137. var value=serializedSettings[key];
  7138. try {
  7139. if (JSON) {
  7140. value=JSON.parse(value, function dateReviver(k, v) {
  7141. var d;
  7142. if (typeof v==='string' && v && v.length > 6 && v.slice(0, 5)===OSF.DDA.SettingsManager.DateJSONPrefix && v.slice(-1)===OSF.DDA.SettingsManager.DataJSONSuffix) {
  7143. d=new Date(parseInt(v.slice(5, -1)));
  7144. if (d) {
  7145. return d;
  7146. }
  7147. }
  7148. return v;
  7149. });
  7150. }
  7151. else {
  7152. value=Sys.Serialization.JavaScriptSerializer.deserialize(value, true);
  7153. }
  7154. ret[key]=value;
  7155. }
  7156. catch (ex) {
  7157. }
  7158. }
  7159. return ret;
  7160. }
  7161. };
  7162. OSF.DDA.Settings=function OSF_DDA_Settings(settings) {
  7163. settings=settings || {};
  7164. var cacheSessionSettings=function (settings) {
  7165. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  7166. if (osfSessionStorage) {
  7167. var serializedSettings=OSF.DDA.SettingsManager.serializeSettings(settings);
  7168. var storageSettings=JSON ? JSON.stringify(serializedSettings) : Sys.Serialization.JavaScriptSerializer.serialize(serializedSettings);
  7169. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  7170. }
  7171. };
  7172. OSF.OUtil.defineEnumerableProperties(this, {
  7173. "get": {
  7174. value: function OSF_DDA_Settings$get(name) {
  7175. var e=Function._validateParams(arguments, [
  7176. { name: "name", type: String, mayBeNull: false }
  7177. ]);
  7178. if (e)
  7179. throw e;
  7180. var setting=settings[name];
  7181. return typeof (setting)==='undefined' ? null : setting;
  7182. }
  7183. },
  7184. "set": {
  7185. value: function OSF_DDA_Settings$set(name, value) {
  7186. var e=Function._validateParams(arguments, [
  7187. { name: "name", type: String, mayBeNull: false },
  7188. { name: "value", mayBeNull: true }
  7189. ]);
  7190. if (e)
  7191. throw e;
  7192. settings[name]=value;
  7193. cacheSessionSettings(settings);
  7194. }
  7195. },
  7196. "remove": {
  7197. value: function OSF_DDA_Settings$remove(name) {
  7198. var e=Function._validateParams(arguments, [
  7199. { name: "name", type: String, mayBeNull: false }
  7200. ]);
  7201. if (e)
  7202. throw e;
  7203. delete settings[name];
  7204. cacheSessionSettings(settings);
  7205. }
  7206. }
  7207. });
  7208. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.SaveAsync], settings);
  7209. };
  7210. OSF.DDA.RefreshableSettings=function OSF_DDA_RefreshableSettings(settings) {
  7211. OSF.DDA.RefreshableSettings.uber.constructor.call(this, settings);
  7212. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.RefreshAsync], settings);
  7213. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.SettingsChanged]));
  7214. };
  7215. OSF.OUtil.extend(OSF.DDA.RefreshableSettings, OSF.DDA.Settings);
  7216. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7217. SettingsChanged: "settingsChanged"
  7218. });
  7219. OSF.DDA.SettingsChangedEventArgs=function OSF_DDA_SettingsChangedEventArgs(settingsInstance) {
  7220. OSF.OUtil.defineEnumerableProperties(this, {
  7221. "type": {
  7222. value: Microsoft.Office.WebExtension.EventType.SettingsChanged
  7223. },
  7224. "settings": {
  7225. value: settingsInstance
  7226. }
  7227. });
  7228. };
  7229. OSF.DDA.AsyncMethodNames.addNames({
  7230. RefreshAsync: "refreshAsync",
  7231. SaveAsync: "saveAsync"
  7232. });
  7233. OSF.DDA.AsyncMethodCalls.define({
  7234. method: OSF.DDA.AsyncMethodNames.RefreshAsync,
  7235. requiredArguments: [],
  7236. supportedOptions: [],
  7237. privateStateCallbacks: [
  7238. {
  7239. name: OSF.DDA.SettingsManager.RefreshingSettings,
  7240. value: function getRefreshingSettings(settingsInstance, settingsCollection) {
  7241. return settingsCollection;
  7242. }
  7243. }
  7244. ],
  7245. onSucceeded: function deserializeSettings(serializedSettingsDescriptor, refreshingSettings, refreshingSettingsArgs) {
  7246. var serializedSettings=serializedSettingsDescriptor[OSF.DDA.SettingsManager.SerializedSettings];
  7247. var newSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  7248. var oldSettings=refreshingSettingsArgs[OSF.DDA.SettingsManager.RefreshingSettings];
  7249. for (var setting in oldSettings) {
  7250. refreshingSettings.remove(setting);
  7251. }
  7252. for (var setting in newSettings) {
  7253. refreshingSettings.set(setting, newSettings[setting]);
  7254. }
  7255. return refreshingSettings;
  7256. }
  7257. });
  7258. OSF.DDA.AsyncMethodCalls.define({
  7259. method: OSF.DDA.AsyncMethodNames.SaveAsync,
  7260. requiredArguments: [],
  7261. supportedOptions: [
  7262. {
  7263. name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale,
  7264. value: {
  7265. "types": ["boolean"],
  7266. "defaultValue": true
  7267. }
  7268. }
  7269. ],
  7270. privateStateCallbacks: [
  7271. {
  7272. name: OSF.DDA.SettingsManager.SerializedSettings,
  7273. value: function serializeSettings(settingsInstance, settingsCollection) {
  7274. return OSF.DDA.SettingsManager.serializeSettings(settingsCollection);
  7275. }
  7276. }
  7277. ]
  7278. });
  7279. OSF.DDA.WAC.SettingsTranslator=(function () {
  7280. var keyIndex=0;
  7281. var valueIndex=1;
  7282. return {
  7283. read: function OSF_DDA_WAC_SettingsTranslator$read(payload) {
  7284. var serializedSettings={};
  7285. var settingsPayload=payload.Settings;
  7286. for (var index in settingsPayload) {
  7287. var setting=settingsPayload[index];
  7288. serializedSettings[setting[keyIndex]]=setting[valueIndex];
  7289. }
  7290. return serializedSettings;
  7291. },
  7292. write: function OSF_DDA_WAC_SettingsTranslator$write(serializedSettings) {
  7293. var settingsPayload=[];
  7294. for (var key in serializedSettings) {
  7295. var setting=[];
  7296. setting[keyIndex]=key;
  7297. setting[valueIndex]=serializedSettings[key];
  7298. settingsPayload.push(setting);
  7299. }
  7300. return settingsPayload;
  7301. }
  7302. };
  7303. })();
  7304. OSF.DDA.WAC.Delegate.ParameterMap.setDynamicType(OSF.DDA.SettingsManager.SerializedSettings, {
  7305. toHost: OSF.DDA.WAC.SettingsTranslator.write,
  7306. fromHost: OSF.DDA.WAC.SettingsTranslator.read
  7307. });
  7308. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7309. type: OSF.DDA.WAC.UniqueArguments.SettingsRequest,
  7310. toHost: [
  7311. { name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale, value: "OverwriteIfStale" },
  7312. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.WAC.UniqueArguments.Properties }
  7313. ],
  7314. invertible: true
  7315. });
  7316. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7317. type: OSF.DDA.MethodDispId.dispidLoadSettingsMethod,
  7318. fromHost: [
  7319. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.WAC.UniqueArguments.Properties }
  7320. ]
  7321. });
  7322. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7323. type: OSF.DDA.MethodDispId.dispidSaveSettingsMethod,
  7324. toHost: [
  7325. { name: OSF.DDA.WAC.UniqueArguments.SettingsRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  7326. ]
  7327. });
  7328. OSF.DDA.WAC.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidSettingsChangedEvent });
  7329. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, { DocumentSelectionChanged: "documentSelectionChanged" });
  7330. OSF.DDA.DocumentSelectionChangedEventArgs=function OSF_DDA_DocumentSelectionChangedEventArgs(docInstance) {
  7331. OSF.OUtil.defineEnumerableProperties(this, {
  7332. "type": {
  7333. value: Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged
  7334. },
  7335. "document": {
  7336. value: docInstance
  7337. }
  7338. });
  7339. };
  7340. OSF.DDA.WAC.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidDocumentSelectionChangedEvent });
  7341. OSF.DDA.FilePropertiesDescriptor={
  7342. Url: "Url"
  7343. };
  7344. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7345. FilePropertiesDescriptor: "FilePropertiesDescriptor"
  7346. });
  7347. Microsoft.Office.WebExtension.FileProperties=function Microsoft_Office_WebExtension_FileProperties(filePropertiesDescriptor) {
  7348. OSF.OUtil.defineEnumerableProperties(this, {
  7349. "url": {
  7350. value: filePropertiesDescriptor[OSF.DDA.FilePropertiesDescriptor.Url]
  7351. }
  7352. });
  7353. };
  7354. OSF.DDA.AsyncMethodNames.addNames({ GetFilePropertiesAsync: "getFilePropertiesAsync" });
  7355. OSF.DDA.AsyncMethodCalls.define({
  7356. method: OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync,
  7357. fromHost: [
  7358. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: 0 }
  7359. ],
  7360. requiredArguments: [],
  7361. supportedOptions: [],
  7362. onSucceeded: function (filePropertiesDescriptor, caller, callArgs) {
  7363. return new Microsoft.Office.WebExtension.FileProperties(filePropertiesDescriptor);
  7364. }
  7365. });
  7366. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  7367. var OSF_DDA_Marshaling_FilePropertiesKeys;
  7368. (function (OSF_DDA_Marshaling_FilePropertiesKeys) {
  7369. OSF_DDA_Marshaling_FilePropertiesKeys[OSF_DDA_Marshaling_FilePropertiesKeys["Properties"]=0]="Properties";
  7370. OSF_DDA_Marshaling_FilePropertiesKeys[OSF_DDA_Marshaling_FilePropertiesKeys["Url"]=1]="Url";
  7371. })(OSF_DDA_Marshaling_FilePropertiesKeys || (OSF_DDA_Marshaling_FilePropertiesKeys={}));
  7372. ;
  7373. OSF.DDA.Marshaling.FilePropertiesKeys=OSF_DDA_Marshaling_FilePropertiesKeys;
  7374. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor);
  7375. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7376. type: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor,
  7377. fromHost: [
  7378. { name: OSF.DDA.FilePropertiesDescriptor.Url, value: OSF.DDA.Marshaling.FilePropertiesKeys.Url }
  7379. ]
  7380. });
  7381. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7382. type: OSF.DDA.MethodDispId.dispidGetFilePropertiesMethod,
  7383. fromHost: [
  7384. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: OSF.DDA.Marshaling.FilePropertiesKeys.Properties }
  7385. ]
  7386. });
  7387. Microsoft.Office.WebExtension.FileType={
  7388. Text: "text",
  7389. Compressed: "compressed",
  7390. Pdf: "pdf"
  7391. };
  7392. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7393. FileProperties: "FileProperties",
  7394. FileSliceProperties: "FileSliceProperties"
  7395. });
  7396. OSF.DDA.FileProperties={
  7397. Handle: "FileHandle",
  7398. FileSize: "FileSize",
  7399. SliceSize: Microsoft.Office.WebExtension.Parameters.SliceSize
  7400. };
  7401. OSF.DDA.File=function OSF_DDA_File(handle, fileSize, sliceSize) {
  7402. OSF.OUtil.defineEnumerableProperties(this, {
  7403. "size": {
  7404. value: fileSize
  7405. },
  7406. "sliceCount": {
  7407. value: Math.ceil(fileSize / sliceSize)
  7408. }
  7409. });
  7410. var privateState={};
  7411. privateState[OSF.DDA.FileProperties.Handle]=handle;
  7412. privateState[OSF.DDA.FileProperties.SliceSize]=sliceSize;
  7413. var am=OSF.DDA.AsyncMethodNames;
  7414. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7415. am.GetDocumentCopyChunkAsync,
  7416. am.ReleaseDocumentCopyAsync
  7417. ], privateState);
  7418. };
  7419. OSF.DDA.FileSliceOffset="fileSliceoffset";
  7420. OSF.DDA.AsyncMethodNames.addNames({
  7421. GetDocumentCopyAsync: "getFileAsync",
  7422. GetDocumentCopyChunkAsync: "getSliceAsync",
  7423. ReleaseDocumentCopyAsync: "closeAsync"
  7424. });
  7425. OSF.DDA.AsyncMethodCalls.define({
  7426. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  7427. requiredArguments: [
  7428. {
  7429. "name": Microsoft.Office.WebExtension.Parameters.FileType,
  7430. "enum": Microsoft.Office.WebExtension.FileType
  7431. }
  7432. ],
  7433. supportedOptions: [
  7434. {
  7435. name: Microsoft.Office.WebExtension.Parameters.SliceSize,
  7436. value: {
  7437. "types": ["number"],
  7438. "defaultValue": 4 * 1024 * 1024
  7439. }
  7440. }
  7441. ],
  7442. checkCallArgs: function (callArgs, caller, stateInfo) {
  7443. var sliceSize=callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize];
  7444. if (sliceSize <=0 || sliceSize > (4 * 1024 * 1024)) {
  7445. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize;
  7446. }
  7447. return callArgs;
  7448. },
  7449. onSucceeded: function (fileDescriptor, caller, callArgs) {
  7450. return new OSF.DDA.File(fileDescriptor[OSF.DDA.FileProperties.Handle], fileDescriptor[OSF.DDA.FileProperties.FileSize], callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize]);
  7451. }
  7452. });
  7453. OSF.DDA.AsyncMethodCalls.define({
  7454. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyChunkAsync,
  7455. requiredArguments: [
  7456. {
  7457. "name": Microsoft.Office.WebExtension.Parameters.SliceIndex,
  7458. "types": ["number"]
  7459. }
  7460. ],
  7461. privateStateCallbacks: [
  7462. {
  7463. name: OSF.DDA.FileProperties.Handle,
  7464. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  7465. },
  7466. {
  7467. name: OSF.DDA.FileProperties.SliceSize,
  7468. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.SliceSize]; }
  7469. }
  7470. ],
  7471. checkCallArgs: function (callArgs, caller, stateInfo) {
  7472. var index=callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex];
  7473. if (index < 0 || index >=caller.sliceCount) {
  7474. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange;
  7475. }
  7476. callArgs[OSF.DDA.FileSliceOffset]=parseInt((index * stateInfo[OSF.DDA.FileProperties.SliceSize]).toString());
  7477. return callArgs;
  7478. },
  7479. onSucceeded: function (sliceDescriptor, caller, callArgs) {
  7480. var slice={};
  7481. OSF.OUtil.defineEnumerableProperties(slice, {
  7482. "data": {
  7483. value: sliceDescriptor[Microsoft.Office.WebExtension.Parameters.Data]
  7484. },
  7485. "index": {
  7486. value: callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex]
  7487. },
  7488. "size": {
  7489. value: sliceDescriptor[OSF.DDA.FileProperties.SliceSize]
  7490. }
  7491. });
  7492. return slice;
  7493. }
  7494. });
  7495. OSF.DDA.AsyncMethodCalls.define({
  7496. method: OSF.DDA.AsyncMethodNames.ReleaseDocumentCopyAsync,
  7497. privateStateCallbacks: [
  7498. {
  7499. name: OSF.DDA.FileProperties.Handle,
  7500. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  7501. }
  7502. ]
  7503. });
  7504. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  7505. OSF.OUtil.setNamespace("File", OSF.DDA.Marshaling);
  7506. var OSF_DDA_Marshaling_File_FilePropertiesKeys;
  7507. (function (OSF_DDA_Marshaling_File_FilePropertiesKeys) {
  7508. OSF_DDA_Marshaling_File_FilePropertiesKeys[OSF_DDA_Marshaling_File_FilePropertiesKeys["Handle"]=0]="Handle";
  7509. OSF_DDA_Marshaling_File_FilePropertiesKeys[OSF_DDA_Marshaling_File_FilePropertiesKeys["FileSize"]=1]="FileSize";
  7510. })(OSF_DDA_Marshaling_File_FilePropertiesKeys || (OSF_DDA_Marshaling_File_FilePropertiesKeys={}));
  7511. ;
  7512. OSF.DDA.Marshaling.File.FilePropertiesKeys=OSF_DDA_Marshaling_File_FilePropertiesKeys;
  7513. var OSF_DDA_Marshaling_File_SlicePropertiesKeys;
  7514. (function (OSF_DDA_Marshaling_File_SlicePropertiesKeys) {
  7515. OSF_DDA_Marshaling_File_SlicePropertiesKeys[OSF_DDA_Marshaling_File_SlicePropertiesKeys["Data"]=0]="Data";
  7516. OSF_DDA_Marshaling_File_SlicePropertiesKeys[OSF_DDA_Marshaling_File_SlicePropertiesKeys["SliceSize"]=1]="SliceSize";
  7517. })(OSF_DDA_Marshaling_File_SlicePropertiesKeys || (OSF_DDA_Marshaling_File_SlicePropertiesKeys={}));
  7518. ;
  7519. OSF.DDA.Marshaling.File.SlicePropertiesKeys=OSF_DDA_Marshaling_File_SlicePropertiesKeys;
  7520. var OSF_DDA_Marshaling_File_FileType;
  7521. (function (OSF_DDA_Marshaling_File_FileType) {
  7522. OSF_DDA_Marshaling_File_FileType[OSF_DDA_Marshaling_File_FileType["Text"]=0]="Text";
  7523. OSF_DDA_Marshaling_File_FileType[OSF_DDA_Marshaling_File_FileType["Compressed"]=1]="Compressed";
  7524. OSF_DDA_Marshaling_File_FileType[OSF_DDA_Marshaling_File_FileType["Pdf"]=2]="Pdf";
  7525. })(OSF_DDA_Marshaling_File_FileType || (OSF_DDA_Marshaling_File_FileType={}));
  7526. ;
  7527. OSF.DDA.Marshaling.File.FileType=OSF_DDA_Marshaling_File_FileType;
  7528. var OSF_DDA_Marshaling_File_ParameterKeys;
  7529. (function (OSF_DDA_Marshaling_File_ParameterKeys) {
  7530. OSF_DDA_Marshaling_File_ParameterKeys[OSF_DDA_Marshaling_File_ParameterKeys["FileType"]=0]="FileType";
  7531. OSF_DDA_Marshaling_File_ParameterKeys[OSF_DDA_Marshaling_File_ParameterKeys["SliceSize"]=1]="SliceSize";
  7532. OSF_DDA_Marshaling_File_ParameterKeys[OSF_DDA_Marshaling_File_ParameterKeys["Handle"]=2]="Handle";
  7533. OSF_DDA_Marshaling_File_ParameterKeys[OSF_DDA_Marshaling_File_ParameterKeys["SliceIndex"]=3]="SliceIndex";
  7534. })(OSF_DDA_Marshaling_File_ParameterKeys || (OSF_DDA_Marshaling_File_ParameterKeys={}));
  7535. ;
  7536. OSF.DDA.Marshaling.File.ParameterKeys=OSF_DDA_Marshaling_File_ParameterKeys;
  7537. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.PropertyDescriptors.FileProperties);
  7538. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.PropertyDescriptors.FileSliceProperties);
  7539. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7540. type: OSF.DDA.PropertyDescriptors.FileProperties,
  7541. fromHost: [
  7542. { name: OSF.DDA.FileProperties.Handle, value: OSF.DDA.Marshaling.File.FilePropertiesKeys.Handle },
  7543. { name: OSF.DDA.FileProperties.FileSize, value: OSF.DDA.Marshaling.File.FilePropertiesKeys.FileSize }
  7544. ]
  7545. });
  7546. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7547. type: OSF.DDA.PropertyDescriptors.FileSliceProperties,
  7548. fromHost: [
  7549. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.Marshaling.File.SlicePropertiesKeys.Data },
  7550. { name: OSF.DDA.FileProperties.SliceSize, value: OSF.DDA.Marshaling.File.SlicePropertiesKeys.SliceSize }
  7551. ]
  7552. });
  7553. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7554. type: Microsoft.Office.WebExtension.Parameters.FileType,
  7555. toHost: [
  7556. { name: Microsoft.Office.WebExtension.FileType.Text, value: OSF.DDA.Marshaling.File.FileType.Text },
  7557. { name: Microsoft.Office.WebExtension.FileType.Compressed, value: OSF.DDA.Marshaling.File.FileType.Compressed },
  7558. { name: Microsoft.Office.WebExtension.FileType.Pdf, value: OSF.DDA.Marshaling.File.FileType.Pdf }
  7559. ]
  7560. });
  7561. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7562. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyMethod,
  7563. toHost: [
  7564. { name: Microsoft.Office.WebExtension.Parameters.FileType, value: OSF.DDA.Marshaling.File.ParameterKeys.FileType },
  7565. { name: Microsoft.Office.WebExtension.Parameters.SliceSize, value: OSF.DDA.Marshaling.File.ParameterKeys.SliceSize }
  7566. ],
  7567. fromHost: [
  7568. { name: OSF.DDA.PropertyDescriptors.FileProperties, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  7569. ]
  7570. });
  7571. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7572. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyChunkMethod,
  7573. toHost: [
  7574. { name: OSF.DDA.FileProperties.Handle, value: OSF.DDA.Marshaling.File.ParameterKeys.Handle },
  7575. { name: Microsoft.Office.WebExtension.Parameters.SliceIndex, value: OSF.DDA.Marshaling.File.ParameterKeys.SliceIndex }
  7576. ],
  7577. fromHost: [
  7578. { name: OSF.DDA.PropertyDescriptors.FileSliceProperties, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  7579. ]
  7580. });
  7581. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7582. type: OSF.DDA.MethodDispId.dispidReleaseDocumentCopyMethod,
  7583. toHost: [{ name: OSF.DDA.FileProperties.Handle, value: OSF.DDA.Marshaling.File.ParameterKeys.Handle }]
  7584. });
  7585. OSF.DDA.AsyncMethodNames.addNames({
  7586. ExecuteRichApiRequestAsync: "executeRichApiRequestAsync"
  7587. });
  7588. OSF.DDA.AsyncMethodCalls.define({
  7589. method: OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync,
  7590. requiredArguments: [
  7591. {
  7592. name: Microsoft.Office.WebExtension.Parameters.Data,
  7593. types: ["object"]
  7594. }
  7595. ],
  7596. supportedOptions: []
  7597. });
  7598. OSF.OUtil.setNamespace("RichApi", OSF.DDA);
  7599. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7600. type: OSF.DDA.MethodDispId.dispidExecuteRichApiRequestMethod,
  7601. toHost: [
  7602. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.ArrayData }
  7603. ],
  7604. fromHost: [
  7605. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  7606. ]
  7607. });
  7608. var OfficeExt;
  7609. (function (OfficeExt) {
  7610. var AppCommand;
  7611. (function (AppCommand) {
  7612. var AppCommandManager=(function () {
  7613. function AppCommandManager() {
  7614. var _this=this;
  7615. this._pseudoDocument=null;
  7616. this._eventDispatch=null;
  7617. this._processAppCommandInvocation=function (args) {
  7618. var verifyResult=_this._verifyManifestCallback(args.callbackName);
  7619. if (verifyResult.errorCode !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  7620. _this._invokeAppCommandCompletedMethod(args.appCommandId, verifyResult.errorCode, "");
  7621. return;
  7622. }
  7623. var eventObj=_this._constructEventObjectForCallback(args);
  7624. if (eventObj) {
  7625. window.setTimeout(function () { verifyResult.callback(eventObj); }, 0);
  7626. }
  7627. else {
  7628. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError, "");
  7629. }
  7630. };
  7631. }
  7632. AppCommandManager.initializeOsfDda=function () {
  7633. OSF.DDA.AsyncMethodNames.addNames({
  7634. AppCommandInvocationCompletedAsync: "appCommandInvocationCompletedAsync"
  7635. });
  7636. OSF.DDA.AsyncMethodCalls.define({
  7637. method: OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  7638. requiredArguments: [{
  7639. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7640. "types": ["string"]
  7641. },
  7642. {
  7643. "name": Microsoft.Office.WebExtension.Parameters.Status,
  7644. "types": ["number"]
  7645. },
  7646. {
  7647. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7648. "types": ["string"]
  7649. }
  7650. ]
  7651. });
  7652. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7653. AppCommandInvokedEvent: "AppCommandInvokedEvent"
  7654. });
  7655. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7656. AppCommandInvoked: "appCommandInvoked"
  7657. });
  7658. OSF.OUtil.setNamespace("AppCommand", OSF.DDA);
  7659. OSF.DDA.AppCommand.AppCommandInvokedEventArgs=OfficeExt.AppCommand.AppCommandInvokedEventArgs;
  7660. };
  7661. AppCommandManager.prototype.initializeAndChangeOnce=function (callback) {
  7662. AppCommand.registerDdaFacade();
  7663. this._pseudoDocument={};
  7664. OSF.DDA.DispIdHost.addAsyncMethods(this._pseudoDocument, [
  7665. OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  7666. ]);
  7667. this._eventDispatch=new OSF.EventDispatch([
  7668. Microsoft.Office.WebExtension.EventType.AppCommandInvoked,
  7669. ]);
  7670. var onRegisterCompleted=function (result) {
  7671. if (callback) {
  7672. if (result.status=="succeeded") {
  7673. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  7674. }
  7675. else {
  7676. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  7677. }
  7678. }
  7679. };
  7680. OSF.DDA.DispIdHost.addEventSupport(this._pseudoDocument, this._eventDispatch);
  7681. this._pseudoDocument.addHandlerAsync(Microsoft.Office.WebExtension.EventType.AppCommandInvoked, this._processAppCommandInvocation, onRegisterCompleted);
  7682. };
  7683. AppCommandManager.prototype._verifyManifestCallback=function (callbackName) {
  7684. var defaultResult={ callback: null, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCallback };
  7685. callbackName=callbackName.trim();
  7686. try {
  7687. var callList=callbackName.split(".");
  7688. var parentObject=window;
  7689. for (var i=0; i < callList.length - 1; i++) {
  7690. if (parentObject[callList[i]] && (typeof parentObject[callList[i]]=="object" || typeof parentObject[callList[i]]=="function")) {
  7691. parentObject=parentObject[callList[i]];
  7692. }
  7693. else {
  7694. return defaultResult;
  7695. }
  7696. }
  7697. var callbackFunc=parentObject[callList[callList.length - 1]];
  7698. if (typeof callbackFunc !="function") {
  7699. return defaultResult;
  7700. }
  7701. }
  7702. catch (e) {
  7703. return defaultResult;
  7704. }
  7705. return { callback: callbackFunc, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess };
  7706. };
  7707. AppCommandManager.prototype._invokeAppCommandCompletedMethod=function (appCommandId, resultCode, data) {
  7708. this._pseudoDocument.appCommandInvocationCompletedAsync(appCommandId, resultCode, data);
  7709. };
  7710. AppCommandManager.prototype._constructEventObjectForCallback=function (args) {
  7711. var _this=this;
  7712. var eventObj=new AppCommandCallbackEventArgs();
  7713. try {
  7714. var jsonData=JSON.parse(args.eventObjStr);
  7715. this._translateEventObjectInternal(jsonData, eventObj);
  7716. Object.defineProperty(eventObj, 'completed', {
  7717. value: function (completedContext) {
  7718. eventObj.completedContext=completedContext;
  7719. var jsonString=JSON.stringify(eventObj);
  7720. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess, jsonString);
  7721. },
  7722. enumerable: true
  7723. });
  7724. }
  7725. catch (e) {
  7726. eventObj=null;
  7727. }
  7728. return eventObj;
  7729. };
  7730. AppCommandManager.prototype._translateEventObjectInternal=function (input, output) {
  7731. for (var key in input) {
  7732. if (!input.hasOwnProperty(key))
  7733. continue;
  7734. var inputChild=input[key];
  7735. if (typeof inputChild=="object" && inputChild !=null) {
  7736. OSF.OUtil.defineEnumerableProperty(output, key, {
  7737. value: {}
  7738. });
  7739. this._translateEventObjectInternal(inputChild, output[key]);
  7740. }
  7741. else {
  7742. Object.defineProperty(output, key, {
  7743. value: inputChild,
  7744. enumerable: true,
  7745. writable: true
  7746. });
  7747. }
  7748. }
  7749. };
  7750. AppCommandManager.prototype._constructObjectByTemplate=function (template, input) {
  7751. var output={};
  7752. if (!template || !input)
  7753. return output;
  7754. for (var key in template) {
  7755. if (template.hasOwnProperty(key)) {
  7756. output[key]=null;
  7757. if (input[key] !=null) {
  7758. var templateChild=template[key];
  7759. var inputChild=input[key];
  7760. var inputChildType=typeof inputChild;
  7761. if (typeof templateChild=="object" && templateChild !=null) {
  7762. output[key]=this._constructObjectByTemplate(templateChild, inputChild);
  7763. }
  7764. else if (inputChildType=="number" || inputChildType=="string" || inputChildType=="boolean") {
  7765. output[key]=inputChild;
  7766. }
  7767. }
  7768. }
  7769. }
  7770. return output;
  7771. };
  7772. AppCommandManager.instance=function () {
  7773. if (AppCommandManager._instance==null) {
  7774. AppCommandManager._instance=new AppCommandManager();
  7775. }
  7776. return AppCommandManager._instance;
  7777. };
  7778. AppCommandManager._instance=null;
  7779. return AppCommandManager;
  7780. })();
  7781. AppCommand.AppCommandManager=AppCommandManager;
  7782. var AppCommandInvokedEventArgs=(function () {
  7783. function AppCommandInvokedEventArgs(appCommandId, callbackName, eventObjStr) {
  7784. this.type=Microsoft.Office.WebExtension.EventType.AppCommandInvoked;
  7785. this.appCommandId=appCommandId;
  7786. this.callbackName=callbackName;
  7787. this.eventObjStr=eventObjStr;
  7788. }
  7789. AppCommandInvokedEventArgs.create=function (eventProperties) {
  7790. return new AppCommandInvokedEventArgs(eventProperties[AppCommand.AppCommandInvokedEventEnums.AppCommandId], eventProperties[AppCommand.AppCommandInvokedEventEnums.CallbackName], eventProperties[AppCommand.AppCommandInvokedEventEnums.EventObjStr]);
  7791. };
  7792. return AppCommandInvokedEventArgs;
  7793. })();
  7794. AppCommand.AppCommandInvokedEventArgs=AppCommandInvokedEventArgs;
  7795. var AppCommandCallbackEventArgs=(function () {
  7796. function AppCommandCallbackEventArgs() {
  7797. }
  7798. return AppCommandCallbackEventArgs;
  7799. })();
  7800. AppCommand.AppCommandCallbackEventArgs=AppCommandCallbackEventArgs;
  7801. AppCommand.AppCommandInvokedEventEnums={
  7802. AppCommandId: "appCommandId",
  7803. CallbackName: "callbackName",
  7804. EventObjStr: "eventObjStr"
  7805. };
  7806. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  7807. })(OfficeExt || (OfficeExt={}));
  7808. OfficeExt.AppCommand.AppCommandManager.initializeOsfDda();
  7809. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  7810. OSF.OUtil.setNamespace("AppCommand", OSF.DDA.Marshaling);
  7811. var OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys;
  7812. (function (OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys) {
  7813. OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys[OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys["AppCommandId"]=0]="AppCommandId";
  7814. OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys[OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys["CallbackName"]=1]="CallbackName";
  7815. OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys[OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys["EventObjStr"]=2]="EventObjStr";
  7816. })(OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys || (OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys={}));
  7817. ;
  7818. OSF.DDA.Marshaling.AppCommand.AppCommandInvokedEventKeys=OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys;
  7819. var OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys;
  7820. (function (OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys) {
  7821. OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys[OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys["Id"]=0]="Id";
  7822. OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys[OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys["Status"]=1]="Status";
  7823. OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys[OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys["Data"]=2]="Data";
  7824. })(OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys || (OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys={}));
  7825. ;
  7826. OSF.DDA.Marshaling.AppCommand.AppCommandCompletedMethodParameterKeys=OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys;
  7827. var OfficeExt;
  7828. (function (OfficeExt) {
  7829. var AppCommand;
  7830. (function (AppCommand) {
  7831. function registerDdaFacade() {
  7832. if (OSF.DDA.WAC) {
  7833. var parameterMap=OSF.DDA.WAC.Delegate.ParameterMap;
  7834. parameterMap.define({
  7835. type: OSF.DDA.MethodDispId.dispidAppCommandInvocationCompletedMethod,
  7836. toHost: [
  7837. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.AppCommand.AppCommandCompletedMethodParameterKeys.Id },
  7838. { name: Microsoft.Office.WebExtension.Parameters.Status, value: OSF.DDA.Marshaling.AppCommand.AppCommandCompletedMethodParameterKeys.Status },
  7839. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.Marshaling.AppCommand.AppCommandCompletedMethodParameterKeys.Data }
  7840. ]
  7841. });
  7842. parameterMap.define({
  7843. type: OSF.DDA.EventDispId.dispidAppCommandInvokedEvent,
  7844. fromHost: [
  7845. { name: OSF.DDA.EventDescriptors.AppCommandInvokedEvent, value: parameterMap.self }
  7846. ]
  7847. });
  7848. parameterMap.addComplexType(OSF.DDA.EventDescriptors.AppCommandInvokedEvent);
  7849. parameterMap.define({
  7850. type: OSF.DDA.EventDescriptors.AppCommandInvokedEvent,
  7851. fromHost: [
  7852. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.AppCommandId, value: OSF.DDA.Marshaling.AppCommand.AppCommandInvokedEventKeys.AppCommandId },
  7853. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.CallbackName, value: OSF.DDA.Marshaling.AppCommand.AppCommandInvokedEventKeys.CallbackName },
  7854. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.EventObjStr, value: OSF.DDA.Marshaling.AppCommand.AppCommandInvokedEventKeys.EventObjStr },
  7855. ]
  7856. });
  7857. }
  7858. }
  7859. AppCommand.registerDdaFacade=registerDdaFacade;
  7860. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  7861. })(OfficeExt || (OfficeExt={}));
  7862. OSF.DialogShownStatus={ hasDialogShown: false, isWindowDialog: false };
  7863. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7864. DialogMessageReceivedEvent: "DialogMessageReceivedEvent"
  7865. });
  7866. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7867. DialogMessageReceived: "dialogMessageReceived",
  7868. DialogEventReceived: "dialogEventReceived"
  7869. });
  7870. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7871. MessageType: "messageType",
  7872. MessageContent: "messageContent"
  7873. });
  7874. OSF.DDA.DialogEventType={};
  7875. OSF.OUtil.augmentList(OSF.DDA.DialogEventType, {
  7876. DialogClosed: "dialogClosed",
  7877. NavigationFailed: "naviationFailed"
  7878. });
  7879. OSF.DDA.AsyncMethodNames.addNames({
  7880. DisplayDialogAsync: "displayDialogAsync",
  7881. CloseAsync: "close"
  7882. });
  7883. OSF.DDA.SyncMethodNames.addNames({
  7884. MessageParent: "messageParent",
  7885. AddMessageHandler: "addEventHandler",
  7886. SendMessage: "sendMessage"
  7887. });
  7888. OSF.DDA.UI.ParentUI=function OSF_DDA_ParentUI() {
  7889. var eventDispatch=new OSF.EventDispatch([
  7890. Microsoft.Office.WebExtension.EventType.DialogMessageReceived,
  7891. Microsoft.Office.WebExtension.EventType.DialogEventReceived,
  7892. Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived
  7893. ]);
  7894. var openDialogName=OSF.DDA.AsyncMethodNames.DisplayDialogAsync.displayName;
  7895. var target=this;
  7896. if (!target[openDialogName]) {
  7897. OSF.OUtil.defineEnumerableProperty(target, openDialogName, {
  7898. value: function () {
  7899. var openDialog=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.OpenDialog];
  7900. openDialog(arguments, eventDispatch, target);
  7901. }
  7902. });
  7903. }
  7904. OSF.OUtil.finalizeProperties(this);
  7905. };
  7906. OSF.DDA.UI.ChildUI=function OSF_DDA_ChildUI(isPopupWindow) {
  7907. var messageParentName=OSF.DDA.SyncMethodNames.MessageParent.displayName;
  7908. var target=this;
  7909. if (!target[messageParentName]) {
  7910. OSF.OUtil.defineEnumerableProperty(target, messageParentName, {
  7911. value: function () {
  7912. var messageParent=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.MessageParent];
  7913. return messageParent(arguments, target);
  7914. }
  7915. });
  7916. }
  7917. var addEventHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  7918. if (!target[addEventHandler] && typeof OSF.DialogParentMessageEventDispatch !="undefined") {
  7919. OSF.DDA.DispIdHost.addEventSupport(target, OSF.DialogParentMessageEventDispatch, isPopupWindow);
  7920. }
  7921. OSF.OUtil.finalizeProperties(this);
  7922. };
  7923. OSF.DialogHandler=function OSF_DialogHandler() { };
  7924. OSF.DDA.DialogEventArgs=function OSF_DDA_DialogEventArgs(message) {
  7925. if (message[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogMessageReceived) {
  7926. OSF.OUtil.defineEnumerableProperties(this, {
  7927. "type": {
  7928. value: Microsoft.Office.WebExtension.EventType.DialogMessageReceived
  7929. },
  7930. "message": {
  7931. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  7932. }
  7933. });
  7934. }
  7935. else {
  7936. OSF.OUtil.defineEnumerableProperties(this, {
  7937. "type": {
  7938. value: Microsoft.Office.WebExtension.EventType.DialogEventReceived
  7939. },
  7940. "error": {
  7941. value: message[OSF.DDA.PropertyDescriptors.MessageType]
  7942. }
  7943. });
  7944. }
  7945. };
  7946. OSF.DDA.DialogParentEventArgs=function OSF_DDA_DialogParentEventArgs(message) {
  7947. OSF.OUtil.defineEnumerableProperties(this, {
  7948. "type": {
  7949. value: Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived
  7950. },
  7951. "message": {
  7952. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  7953. }
  7954. });
  7955. };
  7956. OSF.DDA.AsyncMethodCalls.define({
  7957. method: OSF.DDA.AsyncMethodNames.DisplayDialogAsync,
  7958. requiredArguments: [
  7959. {
  7960. "name": Microsoft.Office.WebExtension.Parameters.Url,
  7961. "types": ["string"]
  7962. }
  7963. ],
  7964. supportedOptions: [
  7965. {
  7966. name: Microsoft.Office.WebExtension.Parameters.Width,
  7967. value: {
  7968. "types": ["number"],
  7969. "defaultValue": 99
  7970. }
  7971. },
  7972. {
  7973. name: Microsoft.Office.WebExtension.Parameters.Height,
  7974. value: {
  7975. "types": ["number"],
  7976. "defaultValue": 99
  7977. }
  7978. },
  7979. {
  7980. name: Microsoft.Office.WebExtension.Parameters.RequireHTTPs,
  7981. value: {
  7982. "types": ["boolean"],
  7983. "defaultValue": true
  7984. }
  7985. },
  7986. {
  7987. name: Microsoft.Office.WebExtension.Parameters.DisplayInIframe,
  7988. value: {
  7989. "types": ["boolean"],
  7990. "defaultValue": false
  7991. }
  7992. }
  7993. ],
  7994. privateStateCallbacks: [],
  7995. onSucceeded: function (args, caller, callArgs) {
  7996. var targetId=args[Microsoft.Office.WebExtension.Parameters.Id];
  7997. var eventDispatch=args[Microsoft.Office.WebExtension.Parameters.Data];
  7998. var dialog=new OSF.DialogHandler();
  7999. var closeDialog=OSF.DDA.AsyncMethodNames.CloseAsync.displayName;
  8000. OSF.OUtil.defineEnumerableProperty(dialog, closeDialog, {
  8001. value: function () {
  8002. var closeDialogfunction=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.CloseDialog];
  8003. closeDialogfunction(arguments, targetId, eventDispatch, dialog);
  8004. }
  8005. });
  8006. var addHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  8007. OSF.OUtil.defineEnumerableProperty(dialog, addHandler, {
  8008. value: function () {
  8009. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.AddMessageHandler.id];
  8010. var callArgs=syncMethodCall.verifyAndExtractCall(arguments, dialog, eventDispatch);
  8011. var eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  8012. var handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  8013. return eventDispatch.addEventHandlerAndFireQueuedEvent(eventType, handler);
  8014. }
  8015. });
  8016. var sendMessage=OSF.DDA.SyncMethodNames.SendMessage.displayName;
  8017. OSF.OUtil.defineEnumerableProperty(dialog, sendMessage, {
  8018. value: function () {
  8019. var execute=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.SendMessage];
  8020. return execute(arguments, eventDispatch, dialog);
  8021. }
  8022. });
  8023. return dialog;
  8024. },
  8025. checkCallArgs: function (callArgs, caller, stateInfo) {
  8026. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] <=0) {
  8027. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=1;
  8028. }
  8029. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] > 100) {
  8030. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=99;
  8031. }
  8032. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] <=0) {
  8033. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=1;
  8034. }
  8035. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] > 100) {
  8036. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=99;
  8037. }
  8038. if (!callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]) {
  8039. callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]=true;
  8040. }
  8041. return callArgs;
  8042. }
  8043. });
  8044. OSF.DDA.AsyncMethodCalls.define({
  8045. method: OSF.DDA.AsyncMethodNames.CloseAsync,
  8046. requiredArguments: [],
  8047. supportedOptions: [],
  8048. privateStateCallbacks: []
  8049. });
  8050. OSF.DDA.SyncMethodCalls.define({
  8051. method: OSF.DDA.SyncMethodNames.MessageParent,
  8052. requiredArguments: [
  8053. {
  8054. "name": Microsoft.Office.WebExtension.Parameters.MessageToParent,
  8055. "types": ["string", "number", "boolean"]
  8056. }
  8057. ],
  8058. supportedOptions: []
  8059. });
  8060. OSF.DDA.SyncMethodCalls.define({
  8061. method: OSF.DDA.SyncMethodNames.AddMessageHandler,
  8062. requiredArguments: [
  8063. {
  8064. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  8065. "enum": Microsoft.Office.WebExtension.EventType,
  8066. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  8067. },
  8068. {
  8069. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  8070. "types": ["function"]
  8071. }
  8072. ],
  8073. supportedOptions: []
  8074. });
  8075. OSF.DDA.SyncMethodCalls.define({
  8076. method: OSF.DDA.SyncMethodNames.SendMessage,
  8077. requiredArguments: [
  8078. {
  8079. "name": Microsoft.Office.WebExtension.Parameters.MessageContent,
  8080. "types": ["string"]
  8081. }
  8082. ],
  8083. supportedOptions: [],
  8084. privateStateCallbacks: []
  8085. });
  8086. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  8087. OSF.OUtil.setNamespace("Dialog", OSF.DDA.Marshaling);
  8088. OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys={
  8089. MessageType: "messageType",
  8090. MessageContent: "messageContent"
  8091. };
  8092. OSF.DDA.Marshaling.Dialog.DialogParentMessageReceivedEventKeys={
  8093. MessageType: "messageType",
  8094. MessageContent: "messageContent"
  8095. };
  8096. OSF.DDA.Marshaling.MessageParentKeys={
  8097. MessageToParent: "messageToParent"
  8098. };
  8099. OSF.DDA.Marshaling.DialogNotificationShownEventType={
  8100. DialogNotificationShown: "dialogNotificationShown"
  8101. };
  8102. OSF.DDA.Marshaling.SendMessageKeys={
  8103. MessageContent: "messageContent"
  8104. };
  8105. var OfficeExt;
  8106. (function (OfficeExt) {
  8107. var WacCommonUICssManager;
  8108. (function (WacCommonUICssManager) {
  8109. var hostType={
  8110. Excel: "excel",
  8111. Word: "word",
  8112. PowerPoint: "powerpoint",
  8113. Outlook: "outlook"
  8114. };
  8115. function getDialogCssManager(applicationHostType) {
  8116. switch (applicationHostType) {
  8117. case hostType.Excel:
  8118. case hostType.Word:
  8119. case hostType.PowerPoint:
  8120. case hostType.Outlook:
  8121. return new DefaultDialogCSSManager();
  8122. default:
  8123. return new DefaultDialogCSSManager();
  8124. }
  8125. return null;
  8126. }
  8127. WacCommonUICssManager.getDialogCssManager=getDialogCssManager;
  8128. var DefaultDialogCSSManager=(function () {
  8129. function DefaultDialogCSSManager() {
  8130. this.overlayElementCSS=[
  8131. "position: absolute",
  8132. "top: 0",
  8133. "left: 0",
  8134. "width: 100%",
  8135. "height: 100%",
  8136. "background-color: rgba(198, 198, 198, 0.5)",
  8137. "z-index: 99998"
  8138. ];
  8139. this.dialogNotificationPanelCSS=[
  8140. "width: 100%",
  8141. "height: 190px",
  8142. "position: absolute",
  8143. "z-index: 99999",
  8144. "background-color: rgba(255, 255, 255, 1)",
  8145. "left: 0px",
  8146. "top: 50%",
  8147. "margin-top: -95px"
  8148. ];
  8149. this.newWindowNotificationTextPanelCSS=[
  8150. "margin: 20px 14px",
  8151. "font-family: Segoe UI,Arial,Verdana,sans-serif",
  8152. "font-size: 14px",
  8153. "height: 100px",
  8154. "line-height: 100px"
  8155. ];
  8156. this.newWindowNotificationTextSpanCSS=[
  8157. "display: inline-block",
  8158. "line-height: normal",
  8159. "vertical-align: middle"
  8160. ];
  8161. this.crossZoneNotificationTextPanelCSS=[
  8162. "margin: 20px 14px",
  8163. "font-family: Segoe UI,Arial,Verdana,sans-serif",
  8164. "font-size: 14px",
  8165. "height: 100px",
  8166. ];
  8167. this.dialogNotificationButtonPanelCSS="margin:0px 9px";
  8168. this.buttonStyleCSS=[
  8169. "text-align: center",
  8170. "width: 70px",
  8171. "height: 25px",
  8172. "font-size: 14px",
  8173. "font-family: Segoe UI,Arial,Verdana,sans-serif",
  8174. "margin: 0px 5px",
  8175. "border-width: 1px",
  8176. "border-style: solid"
  8177. ];
  8178. }
  8179. DefaultDialogCSSManager.prototype.getOverlayElementCSS=function () {
  8180. return this.overlayElementCSS.join(";");
  8181. };
  8182. DefaultDialogCSSManager.prototype.getDialogNotificationPanelCSS=function () {
  8183. return this.dialogNotificationPanelCSS.join(";");
  8184. };
  8185. DefaultDialogCSSManager.prototype.getNewWindowNotificationTextPanelCSS=function () {
  8186. return this.newWindowNotificationTextPanelCSS.join(";");
  8187. };
  8188. DefaultDialogCSSManager.prototype.getNewWindowNotificationTextSpanCSS=function () {
  8189. return this.newWindowNotificationTextSpanCSS.join(";");
  8190. };
  8191. DefaultDialogCSSManager.prototype.getCrossZoneNotificationTextPanelCSS=function () {
  8192. return this.crossZoneNotificationTextPanelCSS.join(";");
  8193. };
  8194. DefaultDialogCSSManager.prototype.getDialogNotificationButtonPanelCSS=function () {
  8195. return this.dialogNotificationButtonPanelCSS;
  8196. };
  8197. DefaultDialogCSSManager.prototype.getDialogButtonCSS=function () {
  8198. return this.buttonStyleCSS.join(";");
  8199. };
  8200. return DefaultDialogCSSManager;
  8201. })();
  8202. WacCommonUICssManager.DefaultDialogCSSManager=DefaultDialogCSSManager;
  8203. })(WacCommonUICssManager=OfficeExt.WacCommonUICssManager || (OfficeExt.WacCommonUICssManager={}));
  8204. })(OfficeExt || (OfficeExt={}));
  8205. var OfficeExt;
  8206. (function (OfficeExt) {
  8207. var AddinNativeAction;
  8208. (function (AddinNativeAction) {
  8209. var Dialog;
  8210. (function (Dialog) {
  8211. var windowInstance=null;
  8212. var handler=null;
  8213. var overlayElement=null;
  8214. var dialogNotificationPanel=null;
  8215. var closeDialogKey="osfDialogInternal:action=closeDialog";
  8216. var showDialogCallback=null;
  8217. var hasCrossZoneNotification=false;
  8218. var checkWindowDialogCloseInterval=-1;
  8219. var hostThemeButtonStyle=null;
  8220. var commonButtonBorderColor="#ababab";
  8221. var commonButtonBackgroundColor="#ffffff";
  8222. var commonEventInButtonBackgroundColor="#ccc";
  8223. var newWindowNotificationId="newWindowNotificaiton";
  8224. var crossZoneNotificationId="crossZoneNotification";
  8225. var configureBrowserLinkId="configureBrowserLink";
  8226. var registerDialogNotificationShownArgs={
  8227. "dispId": OSF.DDA.EventDispId.dispidDialogNotificationShownInAddinEvent,
  8228. "eventType": OSF.DDA.Marshaling.DialogNotificationShownEventType.DialogNotificationShown,
  8229. "onComplete": null
  8230. };
  8231. function setHostThemeButtonStyle(args) {
  8232. var hostThemeButtonStyleArgs=args.input;
  8233. if (hostThemeButtonStyleArgs !=null) {
  8234. hostThemeButtonStyle={
  8235. HostButtonBorderColor: hostThemeButtonStyleArgs[OSF.HostThemeButtonStyleKeys.ButtonBorderColor],
  8236. HostButtonBackgroundColor: hostThemeButtonStyleArgs[OSF.HostThemeButtonStyleKeys.ButtonBackgroundColor]
  8237. };
  8238. }
  8239. args.completed();
  8240. }
  8241. Dialog.setHostThemeButtonStyle=setHostThemeButtonStyle;
  8242. function handleNewWindowDialog(dialogInfo) {
  8243. try {
  8244. hasCrossZoneNotification=false;
  8245. var ignoreButtonKeyDownClick=false;
  8246. var hostInfoObj=OSF._OfficeAppFactory.getInitializationHelper()._hostInfo;
  8247. var dialogCssManager=OfficeExt.WacCommonUICssManager.getDialogCssManager(hostInfoObj.hostType);
  8248. var notificationText=OSF.OUtil.formatString(Strings.OfficeOM.L_ShowWindowDialogNotification, OSF._OfficeAppFactory.getInitializationHelper()._appContext._addinName);
  8249. overlayElement=createOverlayElement(dialogCssManager);
  8250. document.body.insertBefore(overlayElement, document.body.firstChild);
  8251. dialogNotificationPanel=createNotificationPanel(dialogCssManager, notificationText);
  8252. dialogNotificationPanel.id=newWindowNotificationId;
  8253. var dialogNotificationButtonPanel=createButtonPanel(dialogCssManager);
  8254. var allowButton=createButtonControl(dialogCssManager, Strings.OfficeOM.L_ShowWindowDialogNotificationAllow);
  8255. var ignoreButton=createButtonControl(dialogCssManager, Strings.OfficeOM.L_ShowWindowDialogNotificationIgnore);
  8256. dialogNotificationButtonPanel.appendChild(allowButton);
  8257. dialogNotificationButtonPanel.appendChild(ignoreButton);
  8258. dialogNotificationPanel.appendChild(dialogNotificationButtonPanel);
  8259. document.body.insertBefore(dialogNotificationPanel, document.body.firstChild);
  8260. allowButton.onclick=function () {
  8261. showDialog(dialogInfo);
  8262. if (!hasCrossZoneNotification) {
  8263. dismissDialogNotification();
  8264. }
  8265. };
  8266. function ignoreButtonClickEventHandler() {
  8267. function unregisterDialogNotificationShownEventCallback(status) {
  8268. removeDialogNotificationElement();
  8269. setFocusOnFirstElement(status);
  8270. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeEndUserIgnore);
  8271. }
  8272. registerDialogNotificationShownArgs.onComplete=unregisterDialogNotificationShownEventCallback;
  8273. OSF.DDA.WAC.Delegate.unregisterEventAsync(registerDialogNotificationShownArgs);
  8274. }
  8275. ignoreButton.onclick=ignoreButtonClickEventHandler;
  8276. allowButton.addEventListener("keydown", function (event) {
  8277. if (event.shiftKey && event.keyCode==9) {
  8278. handleButtonControlEventOut(allowButton);
  8279. handleButtonControlEventIn(ignoreButton);
  8280. ignoreButton.focus();
  8281. event.preventDefault();
  8282. event.stopPropagation();
  8283. }
  8284. }, false);
  8285. ignoreButton.addEventListener("keydown", function (event) {
  8286. if (!event.shiftKey && event.keyCode==9) {
  8287. handleButtonControlEventOut(ignoreButton);
  8288. handleButtonControlEventIn(allowButton);
  8289. allowButton.focus();
  8290. event.preventDefault();
  8291. event.stopPropagation();
  8292. }
  8293. else if (event.keyCode==13) {
  8294. ignoreButtonKeyDownClick=true;
  8295. event.preventDefault();
  8296. event.stopPropagation();
  8297. }
  8298. }, false);
  8299. ignoreButton.addEventListener("keyup", function (event) {
  8300. if (event.keyCode==13 && ignoreButtonKeyDownClick) {
  8301. ignoreButtonKeyDownClick=false;
  8302. ignoreButtonClickEventHandler();
  8303. event.preventDefault();
  8304. event.stopPropagation();
  8305. }
  8306. }, false);
  8307. window.focus();
  8308. function registerDialogNotificationShownEventCallback(status) {
  8309. allowButton.focus();
  8310. }
  8311. registerDialogNotificationShownArgs.onComplete=registerDialogNotificationShownEventCallback;
  8312. OSF.DDA.WAC.Delegate.registerEventAsync(registerDialogNotificationShownArgs);
  8313. }
  8314. catch (e) {
  8315. if (OSF.AppTelemetry) {
  8316. OSF.AppTelemetry.logAppException("Exception happens at new window dialog."+e);
  8317. }
  8318. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  8319. }
  8320. }
  8321. Dialog.handleNewWindowDialog=handleNewWindowDialog;
  8322. function closeDialog(callback) {
  8323. try {
  8324. if (windowInstance !=null) {
  8325. var appDomains=OSF._OfficeAppFactory.getInitializationHelper()._appContext._appDomains;
  8326. if (appDomains) {
  8327. for (var i=0; i < appDomains.length && appDomains[i].indexOf("://") !==-1; i++) {
  8328. windowInstance.postMessage(closeDialogKey, appDomains[i]);
  8329. }
  8330. }
  8331. if (windowInstance !=null && !windowInstance.closed) {
  8332. windowInstance.close();
  8333. }
  8334. window.removeEventListener("message", receiveMessage);
  8335. window.clearInterval(checkWindowDialogCloseInterval);
  8336. windowInstance=null;
  8337. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  8338. }
  8339. else {
  8340. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  8341. }
  8342. }
  8343. catch (e) {
  8344. if (OSF.AppTelemetry) {
  8345. OSF.AppTelemetry.logAppException("Exception happens at close window dialog."+e);
  8346. }
  8347. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  8348. }
  8349. }
  8350. Dialog.closeDialog=closeDialog;
  8351. function messageParent(params) {
  8352. var message=params.hostCallArgs[Microsoft.Office.WebExtension.Parameters.MessageToParent];
  8353. var appDomains=OSF._OfficeAppFactory.getInitializationHelper()._appContext._appDomains;
  8354. if (appDomains) {
  8355. for (var i=0; i < appDomains.length && appDomains[i].indexOf("://") !==-1; i++) {
  8356. window.opener.postMessage(message, appDomains[i]);
  8357. }
  8358. }
  8359. }
  8360. Dialog.messageParent=messageParent;
  8361. function sendMessage(params) {
  8362. if (windowInstance !=null) {
  8363. var message=params.hostCallArgs, appDomains=OSF._OfficeAppFactory.getInitializationHelper()._appContext._appDomains;
  8364. if (appDomains) {
  8365. for (var i=0; i < appDomains.length && appDomains[i].indexOf("://") !==-1; i++) {
  8366. if (typeof message !="string") {
  8367. message=JSON.stringify(message);
  8368. }
  8369. windowInstance.postMessage(message, appDomains[i]);
  8370. }
  8371. }
  8372. }
  8373. }
  8374. Dialog.sendMessage=sendMessage;
  8375. function registerMessageReceivedEvent() {
  8376. function receiveCloseDialogMessage(event) {
  8377. if (event.source==window.opener) {
  8378. if (typeof event.data==="string" && event.data.indexOf(closeDialogKey) > -1) {
  8379. window.close();
  8380. }
  8381. else {
  8382. var messageContent=event.data, type=typeof messageContent;
  8383. if (messageContent && (type=="object" || type=="string")) {
  8384. if (type=="string") {
  8385. messageContent=JSON.parse(messageContent);
  8386. }
  8387. var eventArgs=OSF.DDA.OMFactory.manufactureEventArgs(Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived, null, messageContent);
  8388. OSF.DialogParentMessageEventDispatch.fireEvent(eventArgs);
  8389. }
  8390. }
  8391. }
  8392. }
  8393. window.addEventListener("message", receiveCloseDialogMessage);
  8394. }
  8395. Dialog.registerMessageReceivedEvent=registerMessageReceivedEvent;
  8396. function setHandlerAndShowDialogCallback(onEventHandler, callback) {
  8397. handler=onEventHandler;
  8398. showDialogCallback=callback;
  8399. }
  8400. Dialog.setHandlerAndShowDialogCallback=setHandlerAndShowDialogCallback;
  8401. function escDismissDialogNotification() {
  8402. try {
  8403. if (dialogNotificationPanel && (dialogNotificationPanel.id==newWindowNotificationId) && showDialogCallback) {
  8404. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeEndUserIgnore);
  8405. }
  8406. }
  8407. catch (e) {
  8408. if (OSF.AppTelemetry) {
  8409. OSF.AppTelemetry.logAppException("Error happened during executing displayDialogAsync callback."+e);
  8410. }
  8411. }
  8412. dismissDialogNotification();
  8413. }
  8414. Dialog.escDismissDialogNotification=escDismissDialogNotification;
  8415. function showCrossZoneNotification(windowUrl, hostType) {
  8416. var okButtonKeyDownClick=false;
  8417. var dialogCssManager=OfficeExt.WacCommonUICssManager.getDialogCssManager(hostType);
  8418. overlayElement=createOverlayElement(dialogCssManager);
  8419. document.body.insertBefore(overlayElement, document.body.firstChild);
  8420. dialogNotificationPanel=createNotificationPanelForCrossZoneIssue(dialogCssManager, windowUrl);
  8421. dialogNotificationPanel.id=crossZoneNotificationId;
  8422. var dialogNotificationButtonPanel=createButtonPanel(dialogCssManager);
  8423. var okButton=createButtonControl(dialogCssManager, "OK");
  8424. dialogNotificationButtonPanel.appendChild(okButton);
  8425. dialogNotificationPanel.appendChild(dialogNotificationButtonPanel);
  8426. document.body.insertBefore(dialogNotificationPanel, document.body.firstChild);
  8427. hasCrossZoneNotification=true;
  8428. okButton.onclick=function () {
  8429. dismissDialogNotification();
  8430. };
  8431. okButton.addEventListener("keydown", function (event) {
  8432. if (event.keyCode==9) {
  8433. document.getElementById(configureBrowserLinkId).focus();
  8434. event.preventDefault();
  8435. event.stopPropagation();
  8436. }
  8437. else if (event.keyCode==13) {
  8438. okButtonKeyDownClick=true;
  8439. event.preventDefault();
  8440. event.stopPropagation();
  8441. }
  8442. }, false);
  8443. okButton.addEventListener("keyup", function (event) {
  8444. if (event.keyCode==13 && okButtonKeyDownClick) {
  8445. okButtonKeyDownClick=false;
  8446. dismissDialogNotification();
  8447. event.preventDefault();
  8448. event.stopPropagation();
  8449. }
  8450. }, false);
  8451. document.getElementById(configureBrowserLinkId).addEventListener("keydown", function (event) {
  8452. if (event.keyCode==9) {
  8453. okButton.focus();
  8454. event.preventDefault();
  8455. event.stopPropagation();
  8456. }
  8457. }, false);
  8458. window.focus();
  8459. okButton.focus();
  8460. }
  8461. Dialog.showCrossZoneNotification=showCrossZoneNotification;
  8462. function receiveMessage(event) {
  8463. if (event.source==windowInstance) {
  8464. try {
  8465. var dialogMessageReceivedArgs={};
  8466. dialogMessageReceivedArgs[OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys.MessageType]=OSF.DialogMessageType.DialogMessageReceived;
  8467. dialogMessageReceivedArgs[OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys.MessageContent]=event.data;
  8468. handler(dialogMessageReceivedArgs);
  8469. }
  8470. catch (e) {
  8471. if (OSF.AppTelemetry) {
  8472. OSF.AppTelemetry.logAppException("Error happened during receive message handler."+e);
  8473. }
  8474. }
  8475. }
  8476. }
  8477. function showDialog(dialogInfo) {
  8478. var hostInfoObj=OSF._OfficeAppFactory.getInitializationHelper()._hostInfo;
  8479. var hostInfoVals=[
  8480. hostInfoObj.hostType,
  8481. hostInfoObj.hostPlatform,
  8482. hostInfoObj.hostSpecificFileVersion,
  8483. hostInfoObj.hostLocale,
  8484. hostInfoObj.osfControlAppCorrelationId,
  8485. "isDialog"
  8486. ];
  8487. var hostInfo=hostInfoVals.join("|");
  8488. var appContext=OSF._OfficeAppFactory.getInitializationHelper()._appContext;
  8489. var windowUrl=dialogInfo[OSF.ShowWindowDialogParameterKeys.Url];
  8490. windowUrl=OfficeExt.WACUtils.addHostInfoAsQueryParam(windowUrl, hostInfo);
  8491. var windowName=JSON.parse(window.name);
  8492. windowName[OSF.WindowNameItemKeys.HostInfo]=hostInfo;
  8493. windowName[OSF.WindowNameItemKeys.AppContext]=appContext;
  8494. var width=dialogInfo[OSF.ShowWindowDialogParameterKeys.Width] * appContext._clientWindowWidth / 100;
  8495. var height=dialogInfo[OSF.ShowWindowDialogParameterKeys.Height] * appContext._clientWindowHeight / 100;
  8496. var left=appContext._clientWindowWidth / 2 - width / 2;
  8497. var top=appContext._clientWindowHeight / 2 - height / 2;
  8498. var windowSpecs="width="+width+", height="+height+", left="+left+", top="+top+",channelmode=no,directories=no,fullscreen=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=no";
  8499. windowInstance=window.open(windowUrl, OfficeExt.WACUtils.serializeObjectToString(windowName), windowSpecs);
  8500. if (windowInstance==null) {
  8501. OSF.AppTelemetry.logAppCommonMessage("Encountered cross zone issue in displayDialogAsync api.");
  8502. removeDialogNotificationElement();
  8503. showCrossZoneNotification(windowUrl, hostInfoObj.hostType);
  8504. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeCrossZone);
  8505. return;
  8506. }
  8507. window.addEventListener("message", receiveMessage);
  8508. function checkWindowClose() {
  8509. try {
  8510. if (windowInstance==null || windowInstance.closed) {
  8511. window.clearInterval(checkWindowDialogCloseInterval);
  8512. window.removeEventListener("message", receiveMessage);
  8513. var dialogClosedArgs={};
  8514. dialogClosedArgs[OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys.MessageType]=OSF.DialogMessageType.DialogClosed;
  8515. handler(dialogClosedArgs);
  8516. }
  8517. }
  8518. catch (e) {
  8519. if (OSF.AppTelemetry) {
  8520. OSF.AppTelemetry.logAppException("Error happened during check or handle window close."+e);
  8521. }
  8522. }
  8523. }
  8524. checkWindowDialogCloseInterval=window.setInterval(checkWindowClose, 1000);
  8525. if (showDialogCallback !=null) {
  8526. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  8527. }
  8528. else {
  8529. if (OSF.AppTelemetry) {
  8530. OSF.AppTelemetry.logAppException("showDialogCallback can not be null.");
  8531. }
  8532. }
  8533. }
  8534. function createButtonControl(dialogCssManager, buttonValue) {
  8535. var buttonControl=document.createElement("input");
  8536. buttonControl.setAttribute("type", "button");
  8537. buttonControl.style.cssText=dialogCssManager.getDialogButtonCSS();
  8538. buttonControl.style.borderColor=commonButtonBorderColor;
  8539. buttonControl.style.backgroundColor=commonButtonBackgroundColor;
  8540. buttonControl.setAttribute("value", buttonValue);
  8541. var buttonControlEventInHandler=function () {
  8542. handleButtonControlEventIn(buttonControl);
  8543. };
  8544. var buttonControlEventOutHandler=function () {
  8545. handleButtonControlEventOut(buttonControl);
  8546. };
  8547. buttonControl.addEventListener("mouseover", buttonControlEventInHandler);
  8548. buttonControl.addEventListener("focus", buttonControlEventInHandler);
  8549. buttonControl.addEventListener("mouseout", buttonControlEventOutHandler);
  8550. buttonControl.addEventListener("focusout", buttonControlEventOutHandler);
  8551. return buttonControl;
  8552. }
  8553. function handleButtonControlEventIn(buttonControl) {
  8554. if (hostThemeButtonStyle !=null) {
  8555. buttonControl.style.borderColor=hostThemeButtonStyle.HostButtonBorderColor;
  8556. buttonControl.style.backgroundColor=hostThemeButtonStyle.HostButtonBackgroundColor;
  8557. }
  8558. else if (OSF.CommonUI && OSF.CommonUI.HostButtonBorderColor && OSF.CommonUI.HostButtonBackgroundColor) {
  8559. buttonControl.style.borderColor=OSF.CommonUI.HostButtonBorderColor;
  8560. buttonControl.style.backgroundColor=OSF.CommonUI.HostButtonBackgroundColor;
  8561. }
  8562. else {
  8563. buttonControl.style.backgroundColor=commonEventInButtonBackgroundColor;
  8564. }
  8565. }
  8566. function handleButtonControlEventOut(buttonControl) {
  8567. buttonControl.style.borderColor=commonButtonBorderColor;
  8568. buttonControl.style.backgroundColor=commonButtonBackgroundColor;
  8569. }
  8570. function dismissDialogNotification() {
  8571. function unregisterDialogNotificationShownEventCallback(status) {
  8572. removeDialogNotificationElement();
  8573. setFocusOnFirstElement(status);
  8574. }
  8575. registerDialogNotificationShownArgs.onComplete=unregisterDialogNotificationShownEventCallback;
  8576. OSF.DDA.WAC.Delegate.unregisterEventAsync(registerDialogNotificationShownArgs);
  8577. }
  8578. function removeDialogNotificationElement() {
  8579. if (dialogNotificationPanel !=null) {
  8580. document.body.removeChild(dialogNotificationPanel);
  8581. dialogNotificationPanel=null;
  8582. }
  8583. if (overlayElement !=null) {
  8584. document.body.removeChild(overlayElement);
  8585. overlayElement=null;
  8586. }
  8587. }
  8588. function createOverlayElement(dialogCssManager) {
  8589. var overlayElement=document.createElement("div");
  8590. overlayElement.style.cssText=dialogCssManager.getOverlayElementCSS();
  8591. return overlayElement;
  8592. }
  8593. function createNotificationPanel(dialogCssManager, notificationString) {
  8594. var dialogNotificationPanel=document.createElement("div");
  8595. dialogNotificationPanel.style.cssText=dialogCssManager.getDialogNotificationPanelCSS();
  8596. var dialogNotificationTextPanel=document.createElement("div");
  8597. dialogNotificationTextPanel.style.cssText=dialogCssManager.getNewWindowNotificationTextPanelCSS();
  8598. if (document.documentElement.getAttribute("dir")=="rtl") {
  8599. dialogNotificationTextPanel.style.paddingRight="30px";
  8600. }
  8601. else {
  8602. dialogNotificationTextPanel.style.paddingLeft="30px";
  8603. }
  8604. var dialogNotificationTextSpan=document.createElement("span");
  8605. dialogNotificationTextSpan.style.cssText=dialogCssManager.getNewWindowNotificationTextSpanCSS();
  8606. dialogNotificationTextSpan.innerText=notificationString;
  8607. dialogNotificationTextPanel.appendChild(dialogNotificationTextSpan);
  8608. dialogNotificationPanel.appendChild(dialogNotificationTextPanel);
  8609. return dialogNotificationPanel;
  8610. }
  8611. function createButtonPanel(dialogCssManager) {
  8612. var dialogNotificationButtonPanel=document.createElement("div");
  8613. dialogNotificationButtonPanel.style.cssText=dialogCssManager.getDialogNotificationButtonPanelCSS();
  8614. if (document.documentElement.getAttribute("dir")=="rtl") {
  8615. dialogNotificationButtonPanel.style.cssFloat="left";
  8616. }
  8617. else {
  8618. dialogNotificationButtonPanel.style.cssFloat="right";
  8619. }
  8620. return dialogNotificationButtonPanel;
  8621. }
  8622. function setFocusOnFirstElement(status) {
  8623. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  8624. var list=document.querySelectorAll(OSF._OfficeAppFactory.getInitializationHelper()._tabbableElements);
  8625. OSF.OUtil.focusToFirstTabbable(list, false);
  8626. }
  8627. }
  8628. function createNotificationPanelForCrossZoneIssue(dialogCssManager, windowUrl) {
  8629. var dialogNotificationPanel=document.createElement("div");
  8630. dialogNotificationPanel.style.cssText=dialogCssManager.getDialogNotificationPanelCSS();
  8631. var dialogNotificationTextPanel=document.createElement("div");
  8632. dialogNotificationTextPanel.style.cssText=dialogCssManager.getCrossZoneNotificationTextPanelCSS();
  8633. var configureBrowserLink=document.createElement("a");
  8634. configureBrowserLink.id=configureBrowserLinkId;
  8635. configureBrowserLink.href="#";
  8636. configureBrowserLink.innerText=Strings.OfficeOM.L_NewWindowCrossZoneConfigureBrowserLink;
  8637. configureBrowserLink.setAttribute("onclick", "window.open('https://support.microsoft.com/en-us/help/17479/windows-internet-explorer-11-change-security-privacy-settings', '_blank', 'fullscreen=1')");
  8638. var dialogNotificationTextSpan=document.createElement("span");
  8639. if (Strings.OfficeOM.L_NewWindowCrossZone) {
  8640. dialogNotificationTextSpan.innerHTML=OSF.OUtil.formatString(Strings.OfficeOM.L_NewWindowCrossZone, configureBrowserLink.outerHTML, OfficeExt.WACUtils.getDomainForUrl(windowUrl));
  8641. }
  8642. dialogNotificationTextPanel.appendChild(dialogNotificationTextSpan);
  8643. dialogNotificationPanel.appendChild(dialogNotificationTextPanel);
  8644. return dialogNotificationPanel;
  8645. }
  8646. })(Dialog=AddinNativeAction.Dialog || (AddinNativeAction.Dialog={}));
  8647. })(AddinNativeAction=OfficeExt.AddinNativeAction || (OfficeExt.AddinNativeAction={}));
  8648. })(OfficeExt || (OfficeExt={}));
  8649. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8650. type: OSF.DDA.EventDispId.dispidDialogMessageReceivedEvent,
  8651. fromHost: [
  8652. { name: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8653. ]
  8654. });
  8655. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.EventDescriptors.DialogMessageReceivedEvent);
  8656. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8657. type: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent,
  8658. fromHost: [
  8659. { name: OSF.DDA.PropertyDescriptors.MessageType, value: OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys.MessageType },
  8660. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys.MessageContent }
  8661. ]
  8662. });
  8663. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8664. type: OSF.DDA.EventDispId.dispidDialogParentMessageReceivedEvent,
  8665. fromHost: [
  8666. { name: OSF.DDA.EventDescriptors.DialogParentMessageReceivedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8667. ]
  8668. });
  8669. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.EventDescriptors.DialogParentMessageReceivedEvent);
  8670. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8671. type: OSF.DDA.EventDescriptors.DialogParentMessageReceivedEvent,
  8672. fromHost: [
  8673. { name: OSF.DDA.PropertyDescriptors.MessageType, value: OSF.DDA.Marshaling.Dialog.DialogParentMessageReceivedEventKeys.MessageType },
  8674. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: OSF.DDA.Marshaling.Dialog.DialogParentMessageReceivedEventKeys.MessageContent }
  8675. ]
  8676. });
  8677. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8678. type: OSF.DDA.MethodDispId.dispidMessageParentMethod,
  8679. toHost: [
  8680. { name: Microsoft.Office.WebExtension.Parameters.MessageToParent, value: OSF.DDA.Marshaling.MessageParentKeys.MessageToParent }
  8681. ]
  8682. });
  8683. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8684. type: OSF.DDA.MethodDispId.dispidSendMessageMethod,
  8685. toHost: [
  8686. { name: Microsoft.Office.WebExtension.Parameters.MessageContent, value: OSF.DDA.Marshaling.SendMessageKeys.MessageContent }
  8687. ]
  8688. });
  8689. OSF.DDA.WAC.Delegate.openDialog=function OSF_DDA_WAC_Delegate$OpenDialog(args) {
  8690. var httpsIdentifyString="https://";
  8691. var httpIdentifyString="http://";
  8692. var dialogInfo=JSON.parse(args.targetId);
  8693. var callback=OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent(true, args);
  8694. function showDialogCallback(status) {
  8695. var payload={ "Error": status };
  8696. callback(Microsoft.Office.Common.InvokeResultCode.noError, payload);
  8697. }
  8698. if (OSF.DialogShownStatus.hasDialogShown) {
  8699. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeDialogAlreadyOpened);
  8700. return;
  8701. }
  8702. var dialogUrl=dialogInfo[OSF.ShowWindowDialogParameterKeys.Url].toLowerCase();
  8703. if (dialogUrl==null || !(dialogUrl.substr(0, httpsIdentifyString.length)===httpsIdentifyString)) {
  8704. if (dialogUrl.substr(0, httpIdentifyString.length)===httpIdentifyString) {
  8705. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeRequireHTTPS);
  8706. }
  8707. else {
  8708. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidScheme);
  8709. }
  8710. return;
  8711. }
  8712. if (!dialogInfo[OSF.ShowWindowDialogParameterKeys.DisplayInIframe]) {
  8713. OSF.DialogShownStatus.isWindowDialog=true;
  8714. OfficeExt.AddinNativeAction.Dialog.setHandlerAndShowDialogCallback(function OSF_DDA_WACDelegate$RegisterEventAsync_OnEvent(payload) {
  8715. if (args.onEvent) {
  8716. args.onEvent(payload);
  8717. }
  8718. if (OSF.AppTelemetry) {
  8719. OSF.AppTelemetry.onEventDone(args.dispId);
  8720. }
  8721. }, showDialogCallback);
  8722. OfficeExt.AddinNativeAction.Dialog.handleNewWindowDialog(dialogInfo);
  8723. }
  8724. else {
  8725. OSF.DialogShownStatus.isWindowDialog=false;
  8726. OSF.DDA.WAC.Delegate.registerEventAsync(args);
  8727. }
  8728. };
  8729. OSF.DDA.WAC.Delegate.messageParent=function OSF_DDA_WAC_Delegate$MessageParent(args) {
  8730. if (window.opener !=null) {
  8731. OfficeExt.AddinNativeAction.Dialog.messageParent(args);
  8732. }
  8733. else {
  8734. OSF.DDA.WAC.Delegate.executeAsync(args);
  8735. }
  8736. };
  8737. OSF.DDA.WAC.Delegate.sendMessage=function OSF_DDA_WAC_Delegate$SendMessage(args) {
  8738. if (OSF.DialogShownStatus.hasDialogShown) {
  8739. if (OSF.DialogShownStatus.isWindowDialog) {
  8740. OfficeExt.AddinNativeAction.Dialog.sendMessage(args);
  8741. }
  8742. else {
  8743. OSF.DDA.WAC.Delegate.executeAsync(args);
  8744. }
  8745. }
  8746. };
  8747. OSF.DDA.WAC.Delegate.closeDialog=function OSF_DDA_WAC_Delegate$CloseDialog(args) {
  8748. var callback=OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent(false, args);
  8749. function closeDialogCallback(status) {
  8750. var payload={ "Error": status };
  8751. callback(Microsoft.Office.Common.InvokeResultCode.noError, payload);
  8752. }
  8753. if (!OSF.DialogShownStatus.hasDialogShown) {
  8754. closeDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeWebDialogClosed);
  8755. }
  8756. else {
  8757. if (OSF.DialogShownStatus.isWindowDialog) {
  8758. if (args.onCalling) {
  8759. args.onCalling();
  8760. }
  8761. OfficeExt.AddinNativeAction.Dialog.closeDialog(closeDialogCallback);
  8762. }
  8763. else {
  8764. OSF.DDA.WAC.Delegate.unregisterEventAsync(args);
  8765. }
  8766. }
  8767. };
  8768. OSF.InitializationHelper.prototype.dismissDialogNotification=function OSF_InitializationHelper$dismissDialogNotification() {
  8769. OfficeExt.AddinNativeAction.Dialog.escDismissDialogNotification();
  8770. };
  8771. OSF.InitializationHelper.prototype.registerMessageReceivedEventForWindowDialog=function OSF_InitializationHelper$registerMessageReceivedEventForWindowDialog() {
  8772. OfficeExt.AddinNativeAction.Dialog.registerMessageReceivedEvent();
  8773. };
  8774. var OSFOneNoteWAC;
  8775. (function (OSFOneNoteWAC) {
  8776. var OneNoteDocument=(function () {
  8777. function OneNoteDocument(officeAppContext, settings) {
  8778. OSF.DDA.OneNoteDocument.uber.constructor.call(this, officeAppContext, settings);
  8779. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  8780. OSF.DDA.AsyncMethodNames.GetSelectedDataAsync,
  8781. OSF.DDA.AsyncMethodNames.SetSelectedDataAsync,
  8782. OSF.DDA.SyncMethodNames.MessageParent
  8783. ]);
  8784. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([
  8785. Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged,
  8786. Microsoft.Office.WebExtension.EventType.DialogMessageReceived
  8787. ]));
  8788. OSF.OUtil.finalizeProperties(this);
  8789. }
  8790. return OneNoteDocument;
  8791. })();
  8792. OSFOneNoteWAC.OneNoteDocument=OneNoteDocument;
  8793. })(OSFOneNoteWAC || (OSFOneNoteWAC={}));
  8794. OSF.DDA.OneNoteDocument=OSFOneNoteWAC.OneNoteDocument;
  8795. OSF.OUtil.extend(OSF.DDA.OneNoteDocument, OSF.DDA.Document);
  8796. OSF.OUtil.redefineList(Microsoft.Office.WebExtension.CoercionType, {
  8797. Html: "html",
  8798. Image: "image",
  8799. Matrix: "matrix",
  8800. Text: "text"
  8801. });
  8802. OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM=function OSF_InitializationHelper$loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath) {
  8803. OSF.DDA.ErrorCodeManager.initializeErrorMessages(Strings.OfficeOM);
  8804. appContext.doc=new OSF.DDA.OneNoteDocument(appContext, this._initializeSettings(appContext, true));
  8805. OSF.DDA.DispIdHost.addAsyncMethods(OSF.DDA.RichApi, [OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync]);
  8806. appReady();
  8807. };
  8808. OSF.InitializationHelper.prototype.prepareRightBeforeWebExtensionInitialize=function OSF_InitializationHelper$prepareRightBeforeWebExtensionInitialize(appContext) {
  8809. OSF.WebApp._UpdateLinksForHostAndXdmInfo();
  8810. var license=new OSF.DDA.License(appContext.get_eToken());
  8811. this.initWebDialog(appContext);
  8812. OSF._OfficeAppFactory.setContext(new OSF.DDA.Context(appContext, appContext.doc, license));
  8813. OSF._OfficeAppFactory.setHostFacade(new OSF.DDA.DispIdHost.Facade(OSF.DDA.WAC.getDelegateMethods, OSF.DDA.WAC.Delegate.ParameterMap));
  8814. var reason=appContext.get_reason();
  8815. Microsoft.Office.WebExtension.initialize(reason);
  8816. var appCommandHandler=OfficeExt.AppCommand.AppCommandManager.instance();
  8817. appCommandHandler.initializeAndChangeOnce();
  8818. };
  8819. var OfficeExtension;
  8820. (function (OfficeExtension) {
  8821. var Action=(function () {
  8822. function Action(actionInfo, isWriteOperation) {
  8823. this.m_actionInfo=actionInfo;
  8824. this.m_isWriteOperation=isWriteOperation;
  8825. }
  8826. Object.defineProperty(Action.prototype, "actionInfo", {
  8827. get: function () {
  8828. return this.m_actionInfo;
  8829. },
  8830. enumerable: true,
  8831. configurable: true
  8832. });
  8833. Object.defineProperty(Action.prototype, "isWriteOperation", {
  8834. get: function () {
  8835. return this.m_isWriteOperation;
  8836. },
  8837. enumerable: true,
  8838. configurable: true
  8839. });
  8840. return Action;
  8841. })();
  8842. OfficeExtension.Action=Action;
  8843. })(OfficeExtension || (OfficeExtension={}));
  8844. var OfficeExtension;
  8845. (function (OfficeExtension) {
  8846. var ActionFactory=(function () {
  8847. function ActionFactory() {
  8848. }
  8849. ActionFactory.createSetPropertyAction=function (context, parent, propertyName, value) {
  8850. OfficeExtension.Utility.validateObjectPath(parent);
  8851. var actionInfo={
  8852. Id: context._nextId(),
  8853. ActionType: 4 ,
  8854. Name: propertyName,
  8855. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8856. ArgumentInfo: {}
  8857. };
  8858. var args=[value];
  8859. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  8860. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  8861. var ret=new OfficeExtension.Action(actionInfo, true);
  8862. context._pendingRequest.addAction(ret);
  8863. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8864. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  8865. return ret;
  8866. };
  8867. ActionFactory.createMethodAction=function (context, parent, methodName, operationType, args) {
  8868. OfficeExtension.Utility.validateObjectPath(parent);
  8869. var actionInfo={
  8870. Id: context._nextId(),
  8871. ActionType: 3 ,
  8872. Name: methodName,
  8873. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8874. ArgumentInfo: {}
  8875. };
  8876. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  8877. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  8878. var isWriteOperation=operationType !=1 ;
  8879. var ret=new OfficeExtension.Action(actionInfo, isWriteOperation);
  8880. context._pendingRequest.addAction(ret);
  8881. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8882. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  8883. return ret;
  8884. };
  8885. ActionFactory.createQueryAction=function (context, parent, queryOption) {
  8886. OfficeExtension.Utility.validateObjectPath(parent);
  8887. var actionInfo={
  8888. Id: context._nextId(),
  8889. ActionType: 2 ,
  8890. Name: "",
  8891. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8892. };
  8893. actionInfo.QueryInfo=queryOption;
  8894. var ret=new OfficeExtension.Action(actionInfo, false);
  8895. context._pendingRequest.addAction(ret);
  8896. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8897. return ret;
  8898. };
  8899. ActionFactory.createRecursiveQueryAction=function (context, parent, query) {
  8900. OfficeExtension.Utility.validateObjectPath(parent);
  8901. var actionInfo={
  8902. Id: context._nextId(),
  8903. ActionType: 6 ,
  8904. Name: "",
  8905. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8906. RecursiveQueryInfo: query
  8907. };
  8908. var ret=new OfficeExtension.Action(actionInfo, false);
  8909. context._pendingRequest.addAction(ret);
  8910. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8911. return ret;
  8912. };
  8913. ActionFactory.createInstantiateAction=function (context, obj) {
  8914. OfficeExtension.Utility.validateObjectPath(obj);
  8915. var actionInfo={
  8916. Id: context._nextId(),
  8917. ActionType: 1 ,
  8918. Name: "",
  8919. ObjectPathId: obj._objectPath.objectPathInfo.Id
  8920. };
  8921. var ret=new OfficeExtension.Action(actionInfo, false);
  8922. context._pendingRequest.addAction(ret);
  8923. context._pendingRequest.addReferencedObjectPath(obj._objectPath);
  8924. context._pendingRequest.addActionResultHandler(ret, new OfficeExtension.InstantiateActionResultHandler(obj));
  8925. return ret;
  8926. };
  8927. ActionFactory.createTraceAction=function (context, message, addTraceMessage) {
  8928. var actionInfo={
  8929. Id: context._nextId(),
  8930. ActionType: 5 ,
  8931. Name: "Trace",
  8932. ObjectPathId: 0
  8933. };
  8934. var ret=new OfficeExtension.Action(actionInfo, false);
  8935. context._pendingRequest.addAction(ret);
  8936. if (addTraceMessage) {
  8937. context._pendingRequest.addTrace(actionInfo.Id, message);
  8938. }
  8939. return ret;
  8940. };
  8941. return ActionFactory;
  8942. })();
  8943. OfficeExtension.ActionFactory=ActionFactory;
  8944. })(OfficeExtension || (OfficeExtension={}));
  8945. var OfficeExtension;
  8946. (function (OfficeExtension) {
  8947. var ClientObject=(function () {
  8948. function ClientObject(context, objectPath) {
  8949. OfficeExtension.Utility.checkArgumentNull(context, "context");
  8950. this.m_context=context;
  8951. this.m_objectPath=objectPath;
  8952. if (this.m_objectPath) {
  8953. if (!context._processingResult) {
  8954. OfficeExtension.ActionFactory.createInstantiateAction(context, this);
  8955. if ((context._autoCleanup) && (this._KeepReference)) {
  8956. context.trackedObjects._autoAdd(this);
  8957. }
  8958. }
  8959. }
  8960. }
  8961. Object.defineProperty(ClientObject.prototype, "context", {
  8962. get: function () {
  8963. return this.m_context;
  8964. },
  8965. enumerable: true,
  8966. configurable: true
  8967. });
  8968. Object.defineProperty(ClientObject.prototype, "_objectPath", {
  8969. get: function () {
  8970. return this.m_objectPath;
  8971. },
  8972. set: function (value) {
  8973. this.m_objectPath=value;
  8974. },
  8975. enumerable: true,
  8976. configurable: true
  8977. });
  8978. Object.defineProperty(ClientObject.prototype, "isNull", {
  8979. get: function () {
  8980. OfficeExtension.Utility.throwIfNotLoaded("isNull", this._isNull, null, this._isNull);
  8981. return this._isNull;
  8982. },
  8983. enumerable: true,
  8984. configurable: true
  8985. });
  8986. Object.defineProperty(ClientObject.prototype, "isNullObject", {
  8987. get: function () {
  8988. OfficeExtension.Utility.throwIfNotLoaded("isNullObject", this._isNull, null, this._isNull);
  8989. return this._isNull;
  8990. },
  8991. enumerable: true,
  8992. configurable: true
  8993. });
  8994. Object.defineProperty(ClientObject.prototype, "_isNull", {
  8995. get: function () {
  8996. return this.m_isNull;
  8997. },
  8998. set: function (value) {
  8999. this.m_isNull=value;
  9000. if (value && this.m_objectPath) {
  9001. this.m_objectPath._updateAsNullObject();
  9002. }
  9003. },
  9004. enumerable: true,
  9005. configurable: true
  9006. });
  9007. ClientObject.prototype._handleResult=function (value) {
  9008. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  9009. };
  9010. ClientObject.prototype._handleIdResult=function (value) {
  9011. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  9012. OfficeExtension.Utility.fixObjectPathIfNecessary(this, value);
  9013. if (value && !OfficeExtension.Utility.isNullOrUndefined(value[OfficeExtension.Constants.referenceId]) && this._initReferenceId) {
  9014. this._initReferenceId(value[OfficeExtension.Constants.referenceId]);
  9015. }
  9016. };
  9017. return ClientObject;
  9018. })();
  9019. OfficeExtension.ClientObject=ClientObject;
  9020. })(OfficeExtension || (OfficeExtension={}));
  9021. var OfficeExtension;
  9022. (function (OfficeExtension) {
  9023. var ClientRequest=(function () {
  9024. function ClientRequest(context) {
  9025. this.m_context=context;
  9026. this.m_actions=[];
  9027. this.m_actionResultHandler={};
  9028. this.m_referencedObjectPaths={};
  9029. this.m_flags=0 ;
  9030. this.m_traceInfos={};
  9031. this.m_pendingProcessEventHandlers=[];
  9032. this.m_pendingEventHandlerActions={};
  9033. this.m_responseTraceIds={};
  9034. this.m_responseTraceMessages=[];
  9035. }
  9036. Object.defineProperty(ClientRequest.prototype, "flags", {
  9037. get: function () {
  9038. return this.m_flags;
  9039. },
  9040. enumerable: true,
  9041. configurable: true
  9042. });
  9043. Object.defineProperty(ClientRequest.prototype, "traceInfos", {
  9044. get: function () {
  9045. return this.m_traceInfos;
  9046. },
  9047. enumerable: true,
  9048. configurable: true
  9049. });
  9050. Object.defineProperty(ClientRequest.prototype, "_responseTraceMessages", {
  9051. get: function () {
  9052. return this.m_responseTraceMessages;
  9053. },
  9054. enumerable: true,
  9055. configurable: true
  9056. });
  9057. Object.defineProperty(ClientRequest.prototype, "_responseTraceIds", {
  9058. get: function () {
  9059. return this.m_responseTraceIds;
  9060. },
  9061. enumerable: true,
  9062. configurable: true
  9063. });
  9064. ClientRequest.prototype._setResponseTraceIds=function (value) {
  9065. if (value) {
  9066. for (var i=0; i < value.length; i++) {
  9067. var traceId=value[i];
  9068. this.m_responseTraceIds[traceId]=traceId;
  9069. var message=this.m_traceInfos[traceId];
  9070. if (!OfficeExtension.Utility.isNullOrUndefined(message)) {
  9071. this.m_responseTraceMessages.push(message);
  9072. }
  9073. }
  9074. }
  9075. };
  9076. ClientRequest.prototype.addAction=function (action) {
  9077. if (action.isWriteOperation) {
  9078. this.m_flags=this.m_flags | 1 ;
  9079. }
  9080. this.m_actions.push(action);
  9081. };
  9082. Object.defineProperty(ClientRequest.prototype, "hasActions", {
  9083. get: function () {
  9084. return this.m_actions.length > 0;
  9085. },
  9086. enumerable: true,
  9087. configurable: true
  9088. });
  9089. ClientRequest.prototype.addTrace=function (actionId, message) {
  9090. this.m_traceInfos[actionId]=message;
  9091. };
  9092. ClientRequest.prototype.addReferencedObjectPath=function (objectPath) {
  9093. if (this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]) {
  9094. return;
  9095. }
  9096. if (!objectPath.isValid) {
  9097. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, OfficeExtension.Utility.getObjectPathExpression(objectPath));
  9098. }
  9099. while (objectPath) {
  9100. if (objectPath.isWriteOperation) {
  9101. this.m_flags=this.m_flags | 1 ;
  9102. }
  9103. this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]=objectPath;
  9104. if (objectPath.objectPathInfo.ObjectPathType==3 ) {
  9105. this.addReferencedObjectPaths(objectPath.argumentObjectPaths);
  9106. }
  9107. objectPath=objectPath.parentObjectPath;
  9108. }
  9109. };
  9110. ClientRequest.prototype.addReferencedObjectPaths=function (objectPaths) {
  9111. if (objectPaths) {
  9112. for (var i=0; i < objectPaths.length; i++) {
  9113. this.addReferencedObjectPath(objectPaths[i]);
  9114. }
  9115. }
  9116. };
  9117. ClientRequest.prototype.addActionResultHandler=function (action, resultHandler) {
  9118. this.m_actionResultHandler[action.actionInfo.Id]=resultHandler;
  9119. };
  9120. ClientRequest.prototype.buildRequestMessageBody=function () {
  9121. var objectPaths={};
  9122. for (var i in this.m_referencedObjectPaths) {
  9123. objectPaths[i]=this.m_referencedObjectPaths[i].objectPathInfo;
  9124. }
  9125. var actions=[];
  9126. for (var index=0; index < this.m_actions.length; index++) {
  9127. actions.push(this.m_actions[index].actionInfo);
  9128. }
  9129. var ret={
  9130. Actions: actions,
  9131. ObjectPaths: objectPaths
  9132. };
  9133. return ret;
  9134. };
  9135. ClientRequest.prototype.processResponse=function (actionResults) {
  9136. if (actionResults) {
  9137. for (var i=0; i < actionResults.length; i++) {
  9138. var actionResult=actionResults[i];
  9139. var handler=this.m_actionResultHandler[actionResult.ActionId];
  9140. if (handler) {
  9141. handler._handleResult(actionResult.Value);
  9142. }
  9143. }
  9144. }
  9145. };
  9146. ClientRequest.prototype.invalidatePendingInvalidObjectPaths=function () {
  9147. for (var i in this.m_referencedObjectPaths) {
  9148. if (this.m_referencedObjectPaths[i].isInvalidAfterRequest) {
  9149. this.m_referencedObjectPaths[i].isValid=false;
  9150. }
  9151. }
  9152. };
  9153. ClientRequest.prototype._addPendingEventHandlerAction=function (eventHandlers, action) {
  9154. if (!this.m_pendingEventHandlerActions[eventHandlers._id]) {
  9155. this.m_pendingEventHandlerActions[eventHandlers._id]=[];
  9156. this.m_pendingProcessEventHandlers.push(eventHandlers);
  9157. }
  9158. this.m_pendingEventHandlerActions[eventHandlers._id].push(action);
  9159. };
  9160. Object.defineProperty(ClientRequest.prototype, "_pendingProcessEventHandlers", {
  9161. get: function () {
  9162. return this.m_pendingProcessEventHandlers;
  9163. },
  9164. enumerable: true,
  9165. configurable: true
  9166. });
  9167. ClientRequest.prototype._getPendingEventHandlerActions=function (eventHandlers) {
  9168. return this.m_pendingEventHandlerActions[eventHandlers._id];
  9169. };
  9170. return ClientRequest;
  9171. })();
  9172. OfficeExtension.ClientRequest=ClientRequest;
  9173. })(OfficeExtension || (OfficeExtension={}));
  9174. var OfficeExtension;
  9175. (function (OfficeExtension) {
  9176. var _requestExecutorFactory;
  9177. function _setRequestExecutorFactory(reqExecFactory) {
  9178. _requestExecutorFactory=reqExecFactory;
  9179. }
  9180. OfficeExtension._setRequestExecutorFactory=_setRequestExecutorFactory;
  9181. var ClientRequestContext=(function () {
  9182. function ClientRequestContext(url) {
  9183. this.m_requestHeaders={};
  9184. this._onRunFinishedNotifiers=[];
  9185. this.m_nextId=0;
  9186. if (OfficeExtension.Utility.isNullOrUndefined(url) || typeof (url)==="string" && url.length===0) {
  9187. var defaultUrlAndHeaders=ClientRequestContext.defaultRequestUrlAndHeaders;
  9188. if (defaultUrlAndHeaders && !OfficeExtension.Utility.isNullOrEmptyString(defaultUrlAndHeaders.url)) {
  9189. this.m_url=defaultUrlAndHeaders.url;
  9190. if (defaultUrlAndHeaders.headers) {
  9191. for (var key in defaultUrlAndHeaders.headers) {
  9192. this.m_requestHeaders[key]=defaultUrlAndHeaders.headers[key];
  9193. }
  9194. }
  9195. }
  9196. else {
  9197. this.m_url=OfficeExtension.Constants.localDocument;
  9198. }
  9199. }
  9200. else if (typeof (url)==="string") {
  9201. this.m_url=url;
  9202. }
  9203. else {
  9204. var requestInfo=url;
  9205. if (OfficeExtension.Utility.isNullOrEmptyString(requestInfo.url)) {
  9206. throw OfficeExtension.Utility.createInvalidArgumentException("url");
  9207. }
  9208. this.m_url=requestInfo.url;
  9209. if (requestInfo.headers) {
  9210. for (var key in requestInfo.headers) {
  9211. this.m_requestHeaders[key]=requestInfo.headers[key];
  9212. }
  9213. }
  9214. }
  9215. this._processingResult=false;
  9216. this._customData=OfficeExtension.Constants.iterativeExecutor;
  9217. if (_requestExecutorFactory) {
  9218. this._requestExecutor=_requestExecutorFactory();
  9219. }
  9220. else {
  9221. if (OfficeExtension.Utility._isLocalDocumentUrl(this.m_url)) {
  9222. this._requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  9223. }
  9224. else {
  9225. this._requestExecutor=new OfficeExtension.HttpRequestExecutor();
  9226. }
  9227. }
  9228. this.sync=this.sync.bind(this);
  9229. }
  9230. Object.defineProperty(ClientRequestContext.prototype, "_url", {
  9231. get: function () {
  9232. return this.m_url;
  9233. },
  9234. enumerable: true,
  9235. configurable: true
  9236. });
  9237. Object.defineProperty(ClientRequestContext.prototype, "_pendingRequest", {
  9238. get: function () {
  9239. if (this.m_pendingRequest==null) {
  9240. this.m_pendingRequest=new OfficeExtension.ClientRequest(this);
  9241. }
  9242. return this.m_pendingRequest;
  9243. },
  9244. enumerable: true,
  9245. configurable: true
  9246. });
  9247. Object.defineProperty(ClientRequestContext.prototype, "trackedObjects", {
  9248. get: function () {
  9249. if (!this.m_trackedObjects) {
  9250. this.m_trackedObjects=new OfficeExtension.TrackedObjects(this);
  9251. }
  9252. return this.m_trackedObjects;
  9253. },
  9254. enumerable: true,
  9255. configurable: true
  9256. });
  9257. Object.defineProperty(ClientRequestContext.prototype, "requestHeaders", {
  9258. get: function () {
  9259. return this.m_requestHeaders;
  9260. },
  9261. enumerable: true,
  9262. configurable: true
  9263. });
  9264. ClientRequestContext.prototype.load=function (clientObj, option) {
  9265. OfficeExtension.Utility.validateContext(this, clientObj);
  9266. var queryOption=ClientRequestContext.parseQueryOption(option);
  9267. var action=OfficeExtension.ActionFactory.createQueryAction(this, clientObj, queryOption);
  9268. this._pendingRequest.addActionResultHandler(action, clientObj);
  9269. };
  9270. ClientRequestContext.parseQueryOption=function (option) {
  9271. var queryOption={};
  9272. if (typeof (option)=="string") {
  9273. var select=option;
  9274. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(select);
  9275. }
  9276. else if (Array.isArray(option)) {
  9277. queryOption.Select=option;
  9278. }
  9279. else if (typeof (option)=="object") {
  9280. var loadOption=option;
  9281. if (typeof (loadOption.select)=="string") {
  9282. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(loadOption.select);
  9283. }
  9284. else if (Array.isArray(loadOption.select)) {
  9285. queryOption.Select=loadOption.select;
  9286. }
  9287. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.select)) {
  9288. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.select");
  9289. }
  9290. if (typeof (loadOption.expand)=="string") {
  9291. queryOption.Expand=OfficeExtension.Utility._parseSelectExpand(loadOption.expand);
  9292. }
  9293. else if (Array.isArray(loadOption.expand)) {
  9294. queryOption.Expand=loadOption.expand;
  9295. }
  9296. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.expand)) {
  9297. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.expand");
  9298. }
  9299. if (typeof (loadOption.top)=="number") {
  9300. queryOption.Top=loadOption.top;
  9301. }
  9302. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.top)) {
  9303. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.top");
  9304. }
  9305. if (typeof (loadOption.skip)=="number") {
  9306. queryOption.Skip=loadOption.skip;
  9307. }
  9308. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.skip)) {
  9309. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.skip");
  9310. }
  9311. }
  9312. else if (!OfficeExtension.Utility.isNullOrUndefined(option)) {
  9313. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option");
  9314. }
  9315. return queryOption;
  9316. };
  9317. ClientRequestContext.prototype.loadRecursive=function (clientObj, options, maxDepth) {
  9318. if (!OfficeExtension.Utility.isPlainJsonObject(options)) {
  9319. throw OfficeExtension.Utility.createInvalidArgumentException("options");
  9320. }
  9321. var quries={};
  9322. for (var key in options) {
  9323. quries[key]=ClientRequestContext.parseQueryOption(options[key]);
  9324. }
  9325. var action=OfficeExtension.ActionFactory.createRecursiveQueryAction(this, clientObj, { Queries: quries, MaxDepth: maxDepth });
  9326. this._pendingRequest.addActionResultHandler(action, clientObj);
  9327. };
  9328. ClientRequestContext.prototype.trace=function (message) {
  9329. OfficeExtension.ActionFactory.createTraceAction(this, message, true);
  9330. };
  9331. ClientRequestContext.prototype.syncPrivate=function () {
  9332. var _this=this;
  9333. var req=this._pendingRequest;
  9334. this.m_pendingRequest=null;
  9335. if (!req.hasActions) {
  9336. return this.processPendingEventHandlers(req);
  9337. }
  9338. var msgBody=req.buildRequestMessageBody();
  9339. var requestFlags=req.flags;
  9340. var requestExecutor=this._requestExecutor;
  9341. if (!requestExecutor) {
  9342. requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  9343. }
  9344. var requestExecutorRequestMessage={
  9345. Url: this.m_url,
  9346. Headers: this.m_requestHeaders,
  9347. Body: msgBody
  9348. };
  9349. req.invalidatePendingInvalidObjectPaths();
  9350. var errorFromResponse=null;
  9351. var errorFromProcessEventHandlers=null;
  9352. return requestExecutor.executeAsync(this._customData, requestFlags, requestExecutorRequestMessage).then(function (response) {
  9353. errorFromResponse=_this.processRequestExecutorResponseMessage(req, response);
  9354. return _this.processPendingEventHandlers(req).catch(function (ex) {
  9355. OfficeExtension.Utility.log("Error in processPendingEventHandlers");
  9356. OfficeExtension.Utility.log(JSON.stringify(ex));
  9357. errorFromProcessEventHandlers=ex;
  9358. });
  9359. }).then(function () {
  9360. if (errorFromResponse) {
  9361. OfficeExtension.Utility.log("Throw error from response: "+JSON.stringify(errorFromResponse));
  9362. throw errorFromResponse;
  9363. }
  9364. if (errorFromProcessEventHandlers) {
  9365. OfficeExtension.Utility.log("Throw error from ProcessEventHandler: "+JSON.stringify(errorFromProcessEventHandlers));
  9366. var transformedError=null;
  9367. if (errorFromProcessEventHandlers instanceof OfficeExtension.Error) {
  9368. transformedError=errorFromProcessEventHandlers;
  9369. transformedError.traceMessages=req._responseTraceMessages;
  9370. }
  9371. else {
  9372. var message=null;
  9373. if (typeof (errorFromProcessEventHandlers)==="string") {
  9374. message=errorFromProcessEventHandlers;
  9375. }
  9376. else {
  9377. message=errorFromProcessEventHandlers.message;
  9378. }
  9379. if (OfficeExtension.Utility.isNullOrEmptyString(message)) {
  9380. message=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.cannotRegisterEvent);
  9381. }
  9382. transformedError=new OfficeExtension._Internal.RuntimeError(OfficeExtension.ErrorCodes.cannotRegisterEvent, message, req._responseTraceMessages, {});
  9383. }
  9384. throw transformedError;
  9385. }
  9386. });
  9387. };
  9388. ClientRequestContext.prototype.processRequestExecutorResponseMessage=function (req, response) {
  9389. if (response.Body && response.Body.TraceIds) {
  9390. req._setResponseTraceIds(response.Body.TraceIds);
  9391. }
  9392. var traceMessages=req._responseTraceMessages;
  9393. if (response.Body) {
  9394. var actionResults=null;
  9395. if (response.Body.Results) {
  9396. actionResults=response.Body.Results;
  9397. }
  9398. else if (response.Body.ProcessedResults && response.Body.ProcessedResults.Results) {
  9399. actionResults=response.Body.ProcessedResults.Results;
  9400. }
  9401. if (actionResults) {
  9402. this._processingResult=true;
  9403. try {
  9404. req.processResponse(actionResults);
  9405. }
  9406. finally {
  9407. this._processingResult=false;
  9408. }
  9409. }
  9410. }
  9411. if (!OfficeExtension.Utility.isNullOrEmptyString(response.ErrorCode)) {
  9412. return new OfficeExtension._Internal.RuntimeError(response.ErrorCode, response.ErrorMessage, traceMessages, {});
  9413. }
  9414. else if (response.Body && response.Body.Error) {
  9415. return new OfficeExtension._Internal.RuntimeError(response.Body.Error.Code, response.Body.Error.Message, traceMessages, {
  9416. errorLocation: response.Body.Error.Location
  9417. });
  9418. }
  9419. return null;
  9420. };
  9421. ClientRequestContext.prototype.processPendingEventHandlers=function (req) {
  9422. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  9423. for (var i=0; i < req._pendingProcessEventHandlers.length; i++) {
  9424. var eventHandlers=req._pendingProcessEventHandlers[i];
  9425. ret=ret.then(this.createProcessOneEventHandlersFunc(eventHandlers, req));
  9426. }
  9427. return ret;
  9428. };
  9429. ClientRequestContext.prototype.createProcessOneEventHandlersFunc=function (eventHandlers, req) {
  9430. return function () { return eventHandlers._processRegistration(req); };
  9431. };
  9432. ClientRequestContext.prototype.sync=function (passThroughValue) {
  9433. return this.syncPrivate().then(function () { return passThroughValue; });
  9434. };
  9435. ClientRequestContext._run=function (ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  9436. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  9437. if (retryDelay===void 0) { retryDelay=5000; }
  9438. return ClientRequestContext._runCommon("run", null, ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  9439. };
  9440. ClientRequestContext._runBatch=function (functionName, receivedRunArgs, ctxInitializer, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  9441. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  9442. if (retryDelay===void 0) { retryDelay=5000; }
  9443. var ctxRetriever;
  9444. var batch;
  9445. var requestInfo=null;
  9446. var argOffset=0;
  9447. if (receivedRunArgs.length > 0 && typeof (receivedRunArgs[0])==="object" && receivedRunArgs[0] !==null && Object.getPrototypeOf(receivedRunArgs[0])===Object.getPrototypeOf({}) && !OfficeExtension.Utility.isNullOrUndefined(receivedRunArgs[0].url)) {
  9448. requestInfo=receivedRunArgs[0];
  9449. argOffset=1;
  9450. }
  9451. if (receivedRunArgs.length==argOffset+1) {
  9452. ctxRetriever=ctxInitializer;
  9453. batch=receivedRunArgs[argOffset+0];
  9454. }
  9455. else if (receivedRunArgs.length==argOffset+2) {
  9456. if (receivedRunArgs[argOffset+0] instanceof OfficeExtension.ClientObject) {
  9457. ctxRetriever=function () { return receivedRunArgs[argOffset+0].context; };
  9458. }
  9459. else if (Array.isArray(receivedRunArgs[argOffset+0])) {
  9460. var array=receivedRunArgs[argOffset+0];
  9461. if (array.length==0) {
  9462. return ClientRequestContext.createErrorPromise(functionName);
  9463. }
  9464. for (var i=0; i < array.length; i++) {
  9465. if (!(array[i] instanceof OfficeExtension.ClientObject)) {
  9466. return ClientRequestContext.createErrorPromise(functionName);
  9467. }
  9468. if (array[i].context !=array[0].context) {
  9469. return ClientRequestContext.createErrorPromise(functionName, OfficeExtension.ResourceStrings.invalidRequestContext);
  9470. }
  9471. }
  9472. ctxRetriever=function () { return array[0].context; };
  9473. }
  9474. else {
  9475. return ClientRequestContext.createErrorPromise(functionName);
  9476. }
  9477. batch=receivedRunArgs[argOffset+1];
  9478. }
  9479. else {
  9480. return ClientRequestContext.createErrorPromise(functionName);
  9481. }
  9482. return ClientRequestContext._runCommon(functionName, requestInfo, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  9483. };
  9484. ClientRequestContext.createErrorPromise=function (functionName, code) {
  9485. if (code===void 0) { code=OfficeExtension.ResourceStrings.invalidArgument; }
  9486. return OfficeExtension.Promise.reject(OfficeExtension.Utility.createRuntimeError(code, OfficeExtension.Utility._getResourceString(code), functionName));
  9487. };
  9488. ClientRequestContext._runCommon=function (functionName, requestInfo, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  9489. var starterPromise=new OfficeExtension.Promise(function (resolve, reject) {
  9490. resolve();
  9491. });
  9492. var ctx;
  9493. var succeeded=false;
  9494. var resultOrError;
  9495. return starterPromise.then(function () {
  9496. ctx=ctxRetriever(requestInfo);
  9497. if (requestInfo && !OfficeExtension.Utility.isNullOrEmptyString(requestInfo.url) && requestInfo.url !==ctx.m_url) {
  9498. return ClientRequestContext.createErrorPromise(functionName, OfficeExtension.ErrorCodes.invalidRequestContext);
  9499. }
  9500. if (ctx._autoCleanup) {
  9501. return new OfficeExtension.Promise(function (resolve, reject) {
  9502. ctx._onRunFinishedNotifiers.push(function () {
  9503. ctx._autoCleanup=true;
  9504. resolve();
  9505. });
  9506. });
  9507. }
  9508. else {
  9509. ctx._autoCleanup=true;
  9510. }
  9511. }).then(function () {
  9512. if (typeof batch !=='function') {
  9513. return ClientRequestContext.createErrorPromise(functionName);
  9514. }
  9515. var batchResult=batch(ctx);
  9516. if (OfficeExtension.Utility.isNullOrUndefined(batchResult) || (typeof batchResult.then !=='function')) {
  9517. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.runMustReturnPromise);
  9518. }
  9519. return batchResult;
  9520. }).then(function (batchResult) {
  9521. return ctx.sync(batchResult);
  9522. }).then(function (result) {
  9523. succeeded=true;
  9524. resultOrError=result;
  9525. }).catch(function (error) {
  9526. resultOrError=error;
  9527. }).then(function () {
  9528. var itemsToRemove=ctx.trackedObjects._retrieveAndClearAutoCleanupList();
  9529. ctx._autoCleanup=false;
  9530. for (var key in itemsToRemove) {
  9531. itemsToRemove[key]._objectPath.isValid=false;
  9532. }
  9533. var cleanupCounter=0;
  9534. if (OfficeExtension.Utility._synchronousCleanup) {
  9535. return attemptCleanup();
  9536. }
  9537. else {
  9538. attemptCleanup();
  9539. }
  9540. function attemptCleanup() {
  9541. cleanupCounter++;
  9542. for (var key in itemsToRemove) {
  9543. ctx.trackedObjects.remove(itemsToRemove[key]);
  9544. }
  9545. return ctx.sync().then(function () {
  9546. if (onCleanupSuccess) {
  9547. onCleanupSuccess(cleanupCounter);
  9548. }
  9549. }).catch(function () {
  9550. if (onCleanupFailure) {
  9551. onCleanupFailure(cleanupCounter);
  9552. }
  9553. if (cleanupCounter < numCleanupAttempts) {
  9554. setTimeout(function () {
  9555. attemptCleanup();
  9556. }, retryDelay);
  9557. }
  9558. });
  9559. }
  9560. }).then(function () {
  9561. if (ctx._onRunFinishedNotifiers && ctx._onRunFinishedNotifiers.length > 0) {
  9562. var func=ctx._onRunFinishedNotifiers.shift();
  9563. func();
  9564. }
  9565. if (succeeded) {
  9566. return resultOrError;
  9567. }
  9568. else {
  9569. throw resultOrError;
  9570. }
  9571. });
  9572. };
  9573. ClientRequestContext.prototype._nextId=function () {
  9574. return++this.m_nextId;
  9575. };
  9576. return ClientRequestContext;
  9577. })();
  9578. OfficeExtension.ClientRequestContext=ClientRequestContext;
  9579. })(OfficeExtension || (OfficeExtension={}));
  9580. var OfficeExtension;
  9581. (function (OfficeExtension) {
  9582. (function (ClientRequestFlags) {
  9583. ClientRequestFlags[ClientRequestFlags["None"]=0]="None";
  9584. ClientRequestFlags[ClientRequestFlags["WriteOperation"]=1]="WriteOperation";
  9585. })(OfficeExtension.ClientRequestFlags || (OfficeExtension.ClientRequestFlags={}));
  9586. var ClientRequestFlags=OfficeExtension.ClientRequestFlags;
  9587. })(OfficeExtension || (OfficeExtension={}));
  9588. var OfficeExtension;
  9589. (function (OfficeExtension) {
  9590. (function (ClientResultProcessingType) {
  9591. ClientResultProcessingType[ClientResultProcessingType["none"]=0]="none";
  9592. ClientResultProcessingType[ClientResultProcessingType["date"]=1]="date";
  9593. })(OfficeExtension.ClientResultProcessingType || (OfficeExtension.ClientResultProcessingType={}));
  9594. var ClientResultProcessingType=OfficeExtension.ClientResultProcessingType;
  9595. var ClientResult=(function () {
  9596. function ClientResult(type) {
  9597. this.m_type=type;
  9598. }
  9599. Object.defineProperty(ClientResult.prototype, "value", {
  9600. get: function () {
  9601. if (!this.m_isLoaded) {
  9602. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.valueNotLoaded);
  9603. }
  9604. return this.m_value;
  9605. },
  9606. enumerable: true,
  9607. configurable: true
  9608. });
  9609. ClientResult.prototype._handleResult=function (value) {
  9610. this.m_isLoaded=true;
  9611. if (typeof (value)==="object" && value && value._IsNull) {
  9612. return;
  9613. }
  9614. if (this.m_type===1 ) {
  9615. this.m_value=OfficeExtension.Utility.adjustToDateTime(value);
  9616. }
  9617. else {
  9618. this.m_value=value;
  9619. }
  9620. };
  9621. return ClientResult;
  9622. })();
  9623. OfficeExtension.ClientResult=ClientResult;
  9624. })(OfficeExtension || (OfficeExtension={}));
  9625. var OfficeExtension;
  9626. (function (OfficeExtension) {
  9627. var Constants=(function () {
  9628. function Constants() {
  9629. }
  9630. Constants.getItemAt="GetItemAt";
  9631. Constants.id="Id";
  9632. Constants.idPrivate="_Id";
  9633. Constants.index="_Index";
  9634. Constants.items="_Items";
  9635. Constants.iterativeExecutor="IterativeExecutor";
  9636. Constants.localDocument="http://document.localhost/";
  9637. Constants.localDocumentApiPrefix="http://document.localhost/_api/";
  9638. Constants.referenceId="_ReferenceId";
  9639. Constants.isTracked="_IsTracked";
  9640. Constants.sourceLibHeader="SdkVersion";
  9641. Constants.requestInfoHeader="Office-RequestInfo";
  9642. return Constants;
  9643. })();
  9644. OfficeExtension.Constants=Constants;
  9645. })(OfficeExtension || (OfficeExtension={}));
  9646. var OfficeExtension;
  9647. (function (OfficeExtension) {
  9648. var EmbedRequestExecutor=(function () {
  9649. function EmbedRequestExecutor() {
  9650. }
  9651. EmbedRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  9652. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, EmbedRequestExecutor.SourceLibHeaderValue);
  9653. return new OfficeExtension.Promise(function (resolve, reject) {
  9654. var endpoint=OfficeExtension.Embedded && OfficeExtension.Embedded._getEndpoint();
  9655. if (!endpoint) {
  9656. resolve(OfficeExtension.RichApiMessageUtility.buildResponseOnError(OfficeExtension.Embedded.EmbeddedApiStatus.InternalError, ""));
  9657. return;
  9658. }
  9659. endpoint.invoke("executeMethod", function (status, result) {
  9660. OfficeExtension.Utility.log("Response:");
  9661. OfficeExtension.Utility.log(JSON.stringify(result));
  9662. var response;
  9663. if (status==OfficeExtension.Embedded.EmbeddedApiStatus.Success) {
  9664. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBodyFromSafeArray(result.Data), OfficeExtension.RichApiMessageUtility.getResponseHeadersFromSafeArray(result.Data));
  9665. }
  9666. else {
  9667. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.Code, result.error.Message);
  9668. }
  9669. resolve(response);
  9670. }, EmbedRequestExecutor._transformMessageArrayIntoParams(messageSafearray));
  9671. });
  9672. };
  9673. EmbedRequestExecutor._transformMessageArrayIntoParams=function (msgArray) {
  9674. return {
  9675. ArrayData: msgArray,
  9676. DdaMethod: {
  9677. DispatchId: EmbedRequestExecutor.DispidExecuteRichApiRequestMethod
  9678. }
  9679. };
  9680. };
  9681. EmbedRequestExecutor.DispidExecuteRichApiRequestMethod=93;
  9682. EmbedRequestExecutor.SourceLibHeaderValue="Embedded";
  9683. return EmbedRequestExecutor;
  9684. })();
  9685. OfficeExtension.EmbedRequestExecutor=EmbedRequestExecutor;
  9686. })(OfficeExtension || (OfficeExtension={}));
  9687. var __extends=this.__extends || function (d, b) {
  9688. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  9689. function __() { this.constructor=d; }
  9690. __.prototype=b.prototype;
  9691. d.prototype=new __();
  9692. };
  9693. var OfficeExtension;
  9694. (function (OfficeExtension) {
  9695. var _Internal;
  9696. (function (_Internal) {
  9697. var RuntimeError=(function (_super) {
  9698. __extends(RuntimeError, _super);
  9699. function RuntimeError(code, message, traceMessages, debugInfo) {
  9700. _super.call(this, message);
  9701. this.name="OfficeExtension.Error";
  9702. this.code=code;
  9703. this.message=message;
  9704. this.traceMessages=traceMessages;
  9705. this.debugInfo=debugInfo;
  9706. }
  9707. RuntimeError.prototype.toString=function () {
  9708. return this.code+': '+this.message;
  9709. };
  9710. return RuntimeError;
  9711. })(Error);
  9712. _Internal.RuntimeError=RuntimeError;
  9713. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  9714. OfficeExtension.Error=OfficeExtension._Internal.RuntimeError;
  9715. })(OfficeExtension || (OfficeExtension={}));
  9716. var OfficeExtension;
  9717. (function (OfficeExtension) {
  9718. var ErrorCodes=(function () {
  9719. function ErrorCodes() {
  9720. }
  9721. ErrorCodes.accessDenied="AccessDenied";
  9722. ErrorCodes.generalException="GeneralException";
  9723. ErrorCodes.activityLimitReached="ActivityLimitReached";
  9724. ErrorCodes.invalidObjectPath="InvalidObjectPath";
  9725. ErrorCodes.propertyNotLoaded="PropertyNotLoaded";
  9726. ErrorCodes.valueNotLoaded="ValueNotLoaded";
  9727. ErrorCodes.invalidRequestContext="InvalidRequestContext";
  9728. ErrorCodes.invalidArgument="InvalidArgument";
  9729. ErrorCodes.runMustReturnPromise="RunMustReturnPromise";
  9730. ErrorCodes.cannotRegisterEvent="CannotRegisterEvent";
  9731. ErrorCodes.apiNotFound="ApiNotFound";
  9732. ErrorCodes.connectionFailure="ConnectionFailure";
  9733. return ErrorCodes;
  9734. })();
  9735. OfficeExtension.ErrorCodes=ErrorCodes;
  9736. })(OfficeExtension || (OfficeExtension={}));
  9737. var OfficeExtension;
  9738. (function (OfficeExtension) {
  9739. var _Internal;
  9740. (function (_Internal) {
  9741. (function (EventHandlerActionType) {
  9742. EventHandlerActionType[EventHandlerActionType["add"]=0]="add";
  9743. EventHandlerActionType[EventHandlerActionType["remove"]=1]="remove";
  9744. EventHandlerActionType[EventHandlerActionType["removeAll"]=2]="removeAll";
  9745. })(_Internal.EventHandlerActionType || (_Internal.EventHandlerActionType={}));
  9746. var EventHandlerActionType=_Internal.EventHandlerActionType;
  9747. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  9748. })(OfficeExtension || (OfficeExtension={}));
  9749. var OfficeExtension;
  9750. (function (OfficeExtension) {
  9751. var EventHandlers=(function () {
  9752. function EventHandlers(context, parentObject, name, eventInfo) {
  9753. var _this=this;
  9754. this.m_id=context._nextId();
  9755. this.m_context=context;
  9756. this.m_name=name;
  9757. this.m_handlers=[];
  9758. this.m_registered=false;
  9759. this.m_eventInfo=eventInfo;
  9760. this.m_callback=function (args) {
  9761. _this.m_eventInfo.eventArgsTransformFunc(args).then(function (newArgs) { return _this.fireEvent(newArgs); });
  9762. };
  9763. }
  9764. Object.defineProperty(EventHandlers.prototype, "_registered", {
  9765. get: function () {
  9766. return this.m_registered;
  9767. },
  9768. enumerable: true,
  9769. configurable: true
  9770. });
  9771. Object.defineProperty(EventHandlers.prototype, "_id", {
  9772. get: function () {
  9773. return this.m_id;
  9774. },
  9775. enumerable: true,
  9776. configurable: true
  9777. });
  9778. Object.defineProperty(EventHandlers.prototype, "_handlers", {
  9779. get: function () {
  9780. return this.m_handlers;
  9781. },
  9782. enumerable: true,
  9783. configurable: true
  9784. });
  9785. EventHandlers.prototype.add=function (handler) {
  9786. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  9787. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 0 });
  9788. return new OfficeExtension.EventHandlerResult(this.m_context, this, handler);
  9789. };
  9790. EventHandlers.prototype.remove=function (handler) {
  9791. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  9792. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 1 });
  9793. };
  9794. EventHandlers.prototype.removeAll=function () {
  9795. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  9796. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: null, operation: 2 });
  9797. };
  9798. EventHandlers.prototype._processRegistration=function (req) {
  9799. var _this=this;
  9800. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  9801. var actions=req._getPendingEventHandlerActions(this);
  9802. if (!actions) {
  9803. return ret;
  9804. }
  9805. var handlersResult=[];
  9806. for (var i=0; i < this.m_handlers.length; i++) {
  9807. handlersResult.push(this.m_handlers[i]);
  9808. }
  9809. var hasChange=false;
  9810. for (var i=0; i < actions.length; i++) {
  9811. if (req._responseTraceIds[actions[i].id]) {
  9812. hasChange=true;
  9813. switch (actions[i].operation) {
  9814. case 0 :
  9815. handlersResult.push(actions[i].handler);
  9816. break;
  9817. case 1 :
  9818. for (var index=handlersResult.length - 1; index >=0; index--) {
  9819. if (handlersResult[index]===actions[i].handler) {
  9820. handlersResult.splice(index, 1);
  9821. break;
  9822. }
  9823. }
  9824. break;
  9825. case 2 :
  9826. handlersResult=[];
  9827. break;
  9828. }
  9829. }
  9830. }
  9831. if (hasChange) {
  9832. if (!this.m_registered && handlersResult.length > 0) {
  9833. ret=ret.then(function () { return _this.m_eventInfo.registerFunc(_this.m_callback); }).then(function () { return (_this.m_registered=true); });
  9834. }
  9835. else if (this.m_registered && handlersResult.length==0) {
  9836. ret=ret.then(function () { return _this.m_eventInfo.unregisterFunc(_this.m_callback); }).catch(function (ex) {
  9837. OfficeExtension.Utility.log("Error when unregister event: "+JSON.stringify(ex));
  9838. }).then(function () { return (_this.m_registered=false); });
  9839. }
  9840. ret=ret.then(function () { return (_this.m_handlers=handlersResult); });
  9841. }
  9842. return ret;
  9843. };
  9844. EventHandlers.prototype.fireEvent=function (args) {
  9845. var promises=[];
  9846. for (var i=0; i < this.m_handlers.length; i++) {
  9847. var handler=this.m_handlers[i];
  9848. var p=OfficeExtension.Utility._createPromiseFromResult(null).then(this.createFireOneEventHandlerFunc(handler, args)).catch(function (ex) {
  9849. OfficeExtension.Utility.log("Error when invoke handler: "+JSON.stringify(ex));
  9850. });
  9851. promises.push(p);
  9852. }
  9853. OfficeExtension.Promise.all(promises);
  9854. };
  9855. EventHandlers.prototype.createFireOneEventHandlerFunc=function (handler, args) {
  9856. return function () { return handler(args); };
  9857. };
  9858. return EventHandlers;
  9859. })();
  9860. OfficeExtension.EventHandlers=EventHandlers;
  9861. })(OfficeExtension || (OfficeExtension={}));
  9862. var OfficeExtension;
  9863. (function (OfficeExtension) {
  9864. var EventHandlerResult=(function () {
  9865. function EventHandlerResult(context, handlers, handler) {
  9866. this.m_context=context;
  9867. this.m_allHandlers=handlers;
  9868. this.m_handler=handler;
  9869. }
  9870. EventHandlerResult.prototype.remove=function () {
  9871. if (this.m_allHandlers && this.m_handler) {
  9872. this.m_allHandlers.remove(this.m_handler);
  9873. this.m_allHandlers=null;
  9874. this.m_handler=null;
  9875. }
  9876. };
  9877. return EventHandlerResult;
  9878. })();
  9879. OfficeExtension.EventHandlerResult=EventHandlerResult;
  9880. })(OfficeExtension || (OfficeExtension={}));
  9881. var OfficeExtension;
  9882. (function (OfficeExtension) {
  9883. var HttpRequestExecutor=(function () {
  9884. function HttpRequestExecutor() {
  9885. }
  9886. HttpRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  9887. var requestMessageText=JSON.stringify(requestMessage.Body);
  9888. OfficeExtension.Utility.log("Request:");
  9889. OfficeExtension.Utility.log(requestMessageText);
  9890. var url=requestMessage.Url;
  9891. if (url.charAt(url.length - 1) !="/") {
  9892. url=url+"/";
  9893. }
  9894. url=url+"ProcessQuery";
  9895. var requestInfo={
  9896. method: "POST",
  9897. url: url,
  9898. headers: {},
  9899. body: requestMessageText
  9900. };
  9901. requestInfo.headers[OfficeExtension.Constants.sourceLibHeader]=HttpRequestExecutor.SourceLibHeaderValue;
  9902. requestInfo.headers[OfficeExtension.Constants.requestInfoHeader]="flags="+requestFlags.toString();
  9903. requestInfo.headers["CONTENT-TYPE"]="application/json";
  9904. if (requestMessage.Headers) {
  9905. for (var key in requestMessage.Headers) {
  9906. requestInfo.headers[key]=requestMessage.Headers[key];
  9907. }
  9908. }
  9909. return OfficeExtension.HttpUtility.sendRequest(requestInfo).then(function (responseInfo) {
  9910. var response;
  9911. if (responseInfo.statusCode===200) {
  9912. response={ ErrorCode: null, ErrorMessage: null, Headers: responseInfo.headers, Body: JSON.parse(responseInfo.body) };
  9913. }
  9914. else {
  9915. var errorObj=null;
  9916. OfficeExtension.Utility.log("Error Response:"+responseInfo.body);
  9917. if (!OfficeExtension.Utility.isNullOrEmptyString(responseInfo.body)) {
  9918. var errorResponseBody=OfficeExtension.Utility.trim(responseInfo.body);
  9919. try {
  9920. errorObj=JSON.parse(errorResponseBody);
  9921. }
  9922. catch (e) {
  9923. OfficeExtension.Utility.log("Error when parse "+errorResponseBody);
  9924. }
  9925. }
  9926. var errorMessage;
  9927. var errorCode;
  9928. if (!OfficeExtension.Utility.isNullOrUndefined(errorObj) && typeof (errorObj)==="object" && errorObj.error) {
  9929. errorCode=errorObj.error.code;
  9930. errorMessage=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithDetails, [responseInfo.statusCode.toString(), errorObj.error.code, errorObj.error.message]);
  9931. }
  9932. else {
  9933. errorMessage=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithStatus, responseInfo.statusCode.toString());
  9934. }
  9935. if (OfficeExtension.Utility.isNullOrEmptyString(errorCode)) {
  9936. errorCode=OfficeExtension.ErrorCodes.connectionFailure;
  9937. }
  9938. response={
  9939. ErrorCode: errorCode,
  9940. ErrorMessage: errorMessage,
  9941. Headers: responseInfo.headers,
  9942. Body: null
  9943. };
  9944. }
  9945. return response;
  9946. });
  9947. };
  9948. HttpRequestExecutor.SourceLibHeaderValue="officejs-rest";
  9949. return HttpRequestExecutor;
  9950. })();
  9951. OfficeExtension.HttpRequestExecutor=HttpRequestExecutor;
  9952. })(OfficeExtension || (OfficeExtension={}));
  9953. var OfficeExtension;
  9954. (function (OfficeExtension) {
  9955. var HttpUtility=(function () {
  9956. function HttpUtility() {
  9957. }
  9958. HttpUtility.setCustomSendRequestFunc=function (func) {
  9959. HttpUtility.s_customSendRequestFunc=func;
  9960. };
  9961. HttpUtility.xhrSendRequestFunc=function (request) {
  9962. return new OfficeExtension.Promise(function (resolve, reject) {
  9963. var xhr=new XMLHttpRequest();
  9964. xhr.open(request.method, request.url);
  9965. xhr.onload=function () {
  9966. var resp={
  9967. statusCode: xhr.status,
  9968. headers: OfficeExtension.Utility._parseHttpResponseHeaders(xhr.getAllResponseHeaders()),
  9969. body: xhr.responseText
  9970. };
  9971. resolve(resp);
  9972. };
  9973. xhr.onerror=function () {
  9974. reject(OfficeExtension.Utility.createRuntimeError(OfficeExtension.ErrorCodes.connectionFailure, OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithStatus, xhr.statusText), null));
  9975. };
  9976. if (request.headers) {
  9977. for (var key in request.headers) {
  9978. xhr.setRequestHeader(key, request.headers[key]);
  9979. }
  9980. }
  9981. xhr.send(request.body);
  9982. });
  9983. };
  9984. HttpUtility.sendRequest=function (request) {
  9985. HttpUtility.validateAndNormalizeRequest(request);
  9986. var func;
  9987. func=HttpUtility.s_customSendRequestFunc || HttpUtility.xhrSendRequestFunc;
  9988. return func(request);
  9989. };
  9990. HttpUtility.setCustomSendLocalDocumentRequestFunc=function (func) {
  9991. HttpUtility.s_customSendLocalDocumentRequestFunc=func;
  9992. };
  9993. HttpUtility.sendLocalDocumentRequest=function (request) {
  9994. HttpUtility.validateAndNormalizeRequest(request);
  9995. var func;
  9996. func=HttpUtility.s_customSendLocalDocumentRequestFunc || HttpUtility.officeJsSendLocalDocumentRequestFunc;
  9997. return func(request);
  9998. };
  9999. HttpUtility.officeJsSendLocalDocumentRequestFunc=function (request) {
  10000. request=OfficeExtension.Utility._validateLocalDocumentRequest(request);
  10001. var requestSafeArray=OfficeExtension.Utility._buildRequestMessageSafeArray(request);
  10002. return new OfficeExtension.Promise(function (resolve, reject) {
  10003. OSF.DDA.RichApi.executeRichApiRequestAsync(requestSafeArray, function (asyncResult) {
  10004. var response;
  10005. if (asyncResult.status=="succeeded") {
  10006. response={
  10007. statusCode: OfficeExtension.RichApiMessageUtility.getResponseStatusCode(asyncResult),
  10008. headers: OfficeExtension.RichApiMessageUtility.getResponseHeaders(asyncResult),
  10009. body: OfficeExtension.RichApiMessageUtility.getResponseBody(asyncResult)
  10010. };
  10011. }
  10012. else {
  10013. response=OfficeExtension.RichApiMessageUtility.buildHttpResponseFromOfficeJsError(asyncResult.error.code, asyncResult.error.message);
  10014. }
  10015. OfficeExtension.Utility.log(JSON.stringify(response));
  10016. resolve(response);
  10017. });
  10018. });
  10019. };
  10020. HttpUtility.validateAndNormalizeRequest=function (request) {
  10021. if (OfficeExtension.Utility.isNullOrUndefined(request)) {
  10022. throw OfficeExtension.Utility.createInvalidArgumentException("request");
  10023. }
  10024. if (OfficeExtension.Utility.isNullOrEmptyString(request.method)) {
  10025. request.method="GET";
  10026. }
  10027. request.method=request.method.toUpperCase();
  10028. };
  10029. return HttpUtility;
  10030. })();
  10031. OfficeExtension.HttpUtility=HttpUtility;
  10032. })(OfficeExtension || (OfficeExtension={}));
  10033. var OfficeExtension;
  10034. (function (OfficeExtension) {
  10035. var InstantiateActionResultHandler=(function () {
  10036. function InstantiateActionResultHandler(clientObject) {
  10037. this.m_clientObject=clientObject;
  10038. }
  10039. InstantiateActionResultHandler.prototype._handleResult=function (value) {
  10040. this.m_clientObject._handleIdResult(value);
  10041. };
  10042. return InstantiateActionResultHandler;
  10043. })();
  10044. OfficeExtension.InstantiateActionResultHandler=InstantiateActionResultHandler;
  10045. })(OfficeExtension || (OfficeExtension={}));
  10046. var OfficeExtension;
  10047. (function (OfficeExtension) {
  10048. })(OfficeExtension || (OfficeExtension={}));
  10049. var OfficeExtension;
  10050. (function (OfficeExtension) {
  10051. (function (RichApiRequestMessageIndex) {
  10052. RichApiRequestMessageIndex[RichApiRequestMessageIndex["CustomData"]=0]="CustomData";
  10053. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Method"]=1]="Method";
  10054. RichApiRequestMessageIndex[RichApiRequestMessageIndex["PathAndQuery"]=2]="PathAndQuery";
  10055. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Headers"]=3]="Headers";
  10056. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Body"]=4]="Body";
  10057. RichApiRequestMessageIndex[RichApiRequestMessageIndex["AppPermission"]=5]="AppPermission";
  10058. RichApiRequestMessageIndex[RichApiRequestMessageIndex["RequestFlags"]=6]="RequestFlags";
  10059. })(OfficeExtension.RichApiRequestMessageIndex || (OfficeExtension.RichApiRequestMessageIndex={}));
  10060. var RichApiRequestMessageIndex=OfficeExtension.RichApiRequestMessageIndex;
  10061. (function (RichApiResponseMessageIndex) {
  10062. RichApiResponseMessageIndex[RichApiResponseMessageIndex["StatusCode"]=0]="StatusCode";
  10063. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Headers"]=1]="Headers";
  10064. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Body"]=2]="Body";
  10065. })(OfficeExtension.RichApiResponseMessageIndex || (OfficeExtension.RichApiResponseMessageIndex={}));
  10066. var RichApiResponseMessageIndex=OfficeExtension.RichApiResponseMessageIndex;
  10067. ;
  10068. (function (ActionType) {
  10069. ActionType[ActionType["Instantiate"]=1]="Instantiate";
  10070. ActionType[ActionType["Query"]=2]="Query";
  10071. ActionType[ActionType["Method"]=3]="Method";
  10072. ActionType[ActionType["SetProperty"]=4]="SetProperty";
  10073. ActionType[ActionType["Trace"]=5]="Trace";
  10074. ActionType[ActionType["RecursiveQuery"]=6]="RecursiveQuery";
  10075. })(OfficeExtension.ActionType || (OfficeExtension.ActionType={}));
  10076. var ActionType=OfficeExtension.ActionType;
  10077. (function (ObjectPathType) {
  10078. ObjectPathType[ObjectPathType["GlobalObject"]=1]="GlobalObject";
  10079. ObjectPathType[ObjectPathType["NewObject"]=2]="NewObject";
  10080. ObjectPathType[ObjectPathType["Method"]=3]="Method";
  10081. ObjectPathType[ObjectPathType["Property"]=4]="Property";
  10082. ObjectPathType[ObjectPathType["Indexer"]=5]="Indexer";
  10083. ObjectPathType[ObjectPathType["ReferenceId"]=6]="ReferenceId";
  10084. ObjectPathType[ObjectPathType["NullObject"]=7]="NullObject";
  10085. })(OfficeExtension.ObjectPathType || (OfficeExtension.ObjectPathType={}));
  10086. var ObjectPathType=OfficeExtension.ObjectPathType;
  10087. })(OfficeExtension || (OfficeExtension={}));
  10088. var OfficeExtension;
  10089. (function (OfficeExtension) {
  10090. var ObjectPath=(function () {
  10091. function ObjectPath(objectPathInfo, parentObjectPath, isCollection, isInvalidAfterRequest) {
  10092. this.m_objectPathInfo=objectPathInfo;
  10093. this.m_parentObjectPath=parentObjectPath;
  10094. this.m_isWriteOperation=false;
  10095. this.m_isCollection=isCollection;
  10096. this.m_isInvalidAfterRequest=isInvalidAfterRequest;
  10097. this.m_isValid=true;
  10098. }
  10099. Object.defineProperty(ObjectPath.prototype, "objectPathInfo", {
  10100. get: function () {
  10101. return this.m_objectPathInfo;
  10102. },
  10103. enumerable: true,
  10104. configurable: true
  10105. });
  10106. Object.defineProperty(ObjectPath.prototype, "isWriteOperation", {
  10107. get: function () {
  10108. return this.m_isWriteOperation;
  10109. },
  10110. set: function (value) {
  10111. this.m_isWriteOperation=value;
  10112. },
  10113. enumerable: true,
  10114. configurable: true
  10115. });
  10116. Object.defineProperty(ObjectPath.prototype, "isCollection", {
  10117. get: function () {
  10118. return this.m_isCollection;
  10119. },
  10120. enumerable: true,
  10121. configurable: true
  10122. });
  10123. Object.defineProperty(ObjectPath.prototype, "isInvalidAfterRequest", {
  10124. get: function () {
  10125. return this.m_isInvalidAfterRequest;
  10126. },
  10127. enumerable: true,
  10128. configurable: true
  10129. });
  10130. Object.defineProperty(ObjectPath.prototype, "parentObjectPath", {
  10131. get: function () {
  10132. return this.m_parentObjectPath;
  10133. },
  10134. enumerable: true,
  10135. configurable: true
  10136. });
  10137. Object.defineProperty(ObjectPath.prototype, "argumentObjectPaths", {
  10138. get: function () {
  10139. return this.m_argumentObjectPaths;
  10140. },
  10141. set: function (value) {
  10142. this.m_argumentObjectPaths=value;
  10143. },
  10144. enumerable: true,
  10145. configurable: true
  10146. });
  10147. Object.defineProperty(ObjectPath.prototype, "isValid", {
  10148. get: function () {
  10149. return this.m_isValid;
  10150. },
  10151. set: function (value) {
  10152. this.m_isValid=value;
  10153. },
  10154. enumerable: true,
  10155. configurable: true
  10156. });
  10157. Object.defineProperty(ObjectPath.prototype, "getByIdMethodName", {
  10158. get: function () {
  10159. return this.m_getByIdMethodName;
  10160. },
  10161. set: function (value) {
  10162. this.m_getByIdMethodName=value;
  10163. },
  10164. enumerable: true,
  10165. configurable: true
  10166. });
  10167. ObjectPath.prototype._updateAsNullObject=function () {
  10168. this.m_isInvalidAfterRequest=false;
  10169. this.m_isValid=true;
  10170. this.m_objectPathInfo.ObjectPathType=7 ;
  10171. this.m_objectPathInfo.Name="";
  10172. this.m_objectPathInfo.ArgumentInfo={};
  10173. this.m_parentObjectPath=null;
  10174. this.m_argumentObjectPaths=null;
  10175. };
  10176. ObjectPath.prototype.updateUsingObjectData=function (value) {
  10177. var referenceId=value[OfficeExtension.Constants.referenceId];
  10178. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  10179. this.m_isInvalidAfterRequest=false;
  10180. this.m_isValid=true;
  10181. this.m_objectPathInfo.ObjectPathType=6 ;
  10182. this.m_objectPathInfo.Name=referenceId;
  10183. this.m_objectPathInfo.ArgumentInfo={};
  10184. this.m_parentObjectPath=null;
  10185. this.m_argumentObjectPaths=null;
  10186. return;
  10187. }
  10188. var parentIsCollection=this.parentObjectPath && this.parentObjectPath.isCollection;
  10189. var getByIdMethodName=this.getByIdMethodName;
  10190. if (parentIsCollection || !OfficeExtension.Utility.isNullOrEmptyString(getByIdMethodName)) {
  10191. var id=value[OfficeExtension.Constants.id];
  10192. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  10193. id=value[OfficeExtension.Constants.idPrivate];
  10194. }
  10195. if (!OfficeExtension.Utility.isNullOrUndefined(id)) {
  10196. this.m_isInvalidAfterRequest=false;
  10197. this.m_isValid=true;
  10198. if (parentIsCollection) {
  10199. this.m_objectPathInfo.ObjectPathType=5 ;
  10200. this.m_objectPathInfo.Name="";
  10201. }
  10202. else {
  10203. this.m_objectPathInfo.ObjectPathType=3 ;
  10204. this.m_objectPathInfo.Name=getByIdMethodName;
  10205. this.m_getByIdMethodName=null;
  10206. }
  10207. this.isWriteOperation=false;
  10208. this.m_objectPathInfo.ArgumentInfo={};
  10209. this.m_objectPathInfo.ArgumentInfo.Arguments=[id];
  10210. this.m_argumentObjectPaths=null;
  10211. return;
  10212. }
  10213. }
  10214. };
  10215. return ObjectPath;
  10216. })();
  10217. OfficeExtension.ObjectPath=ObjectPath;
  10218. })(OfficeExtension || (OfficeExtension={}));
  10219. var OfficeExtension;
  10220. (function (OfficeExtension) {
  10221. var ObjectPathFactory=(function () {
  10222. function ObjectPathFactory() {
  10223. }
  10224. ObjectPathFactory.createGlobalObjectObjectPath=function (context) {
  10225. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 1 , Name: "" };
  10226. return new OfficeExtension.ObjectPath(objectPathInfo, null, false, false);
  10227. };
  10228. ObjectPathFactory.createNewObjectObjectPath=function (context, typeName, isCollection) {
  10229. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 2 , Name: typeName };
  10230. return new OfficeExtension.ObjectPath(objectPathInfo, null, isCollection, false);
  10231. };
  10232. ObjectPathFactory.createPropertyObjectPath=function (context, parent, propertyName, isCollection, isInvalidAfterRequest) {
  10233. var objectPathInfo={
  10234. Id: context._nextId(),
  10235. ObjectPathType: 4 ,
  10236. Name: propertyName,
  10237. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  10238. };
  10239. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  10240. };
  10241. ObjectPathFactory.createIndexerObjectPath=function (context, parent, args) {
  10242. var objectPathInfo={
  10243. Id: context._nextId(),
  10244. ObjectPathType: 5 ,
  10245. Name: "",
  10246. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  10247. ArgumentInfo: {}
  10248. };
  10249. objectPathInfo.ArgumentInfo.Arguments=args;
  10250. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  10251. };
  10252. ObjectPathFactory.createIndexerObjectPathUsingParentPath=function (context, parentObjectPath, args) {
  10253. var objectPathInfo={
  10254. Id: context._nextId(),
  10255. ObjectPathType: 5 ,
  10256. Name: "",
  10257. ParentObjectPathId: parentObjectPath.objectPathInfo.Id,
  10258. ArgumentInfo: {}
  10259. };
  10260. objectPathInfo.ArgumentInfo.Arguments=args;
  10261. return new OfficeExtension.ObjectPath(objectPathInfo, parentObjectPath, false, false);
  10262. };
  10263. ObjectPathFactory.createMethodObjectPath=function (context, parent, methodName, operationType, args, isCollection, isInvalidAfterRequest, getByIdMethodName) {
  10264. var objectPathInfo={
  10265. Id: context._nextId(),
  10266. ObjectPathType: 3 ,
  10267. Name: methodName,
  10268. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  10269. ArgumentInfo: {}
  10270. };
  10271. var argumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, objectPathInfo.ArgumentInfo, args);
  10272. var ret=new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  10273. ret.argumentObjectPaths=argumentObjectPaths;
  10274. ret.isWriteOperation=(operationType !=1 );
  10275. ret.getByIdMethodName=getByIdMethodName;
  10276. return ret;
  10277. };
  10278. ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt=function (hasIndexerMethod, context, parent, childItem, index) {
  10279. var id=childItem[OfficeExtension.Constants.id];
  10280. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  10281. id=childItem[OfficeExtension.Constants.idPrivate];
  10282. }
  10283. if (hasIndexerMethod && !OfficeExtension.Utility.isNullOrUndefined(id)) {
  10284. return ObjectPathFactory.createChildItemObjectPathUsingIndexer(context, parent, childItem);
  10285. }
  10286. else {
  10287. return ObjectPathFactory.createChildItemObjectPathUsingGetItemAt(context, parent, childItem, index);
  10288. }
  10289. };
  10290. ObjectPathFactory.createChildItemObjectPathUsingIndexer=function (context, parent, childItem) {
  10291. var id=childItem[OfficeExtension.Constants.id];
  10292. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  10293. id=childItem[OfficeExtension.Constants.idPrivate];
  10294. }
  10295. var objectPathInfo=objectPathInfo={
  10296. Id: context._nextId(),
  10297. ObjectPathType: 5 ,
  10298. Name: "",
  10299. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  10300. ArgumentInfo: {}
  10301. };
  10302. objectPathInfo.ArgumentInfo.Arguments=[id];
  10303. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  10304. };
  10305. ObjectPathFactory.createChildItemObjectPathUsingGetItemAt=function (context, parent, childItem, index) {
  10306. var indexFromServer=childItem[OfficeExtension.Constants.index];
  10307. if (indexFromServer) {
  10308. index=indexFromServer;
  10309. }
  10310. var objectPathInfo={
  10311. Id: context._nextId(),
  10312. ObjectPathType: 3 ,
  10313. Name: OfficeExtension.Constants.getItemAt,
  10314. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  10315. ArgumentInfo: {}
  10316. };
  10317. objectPathInfo.ArgumentInfo.Arguments=[index];
  10318. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  10319. };
  10320. return ObjectPathFactory;
  10321. })();
  10322. OfficeExtension.ObjectPathFactory=ObjectPathFactory;
  10323. })(OfficeExtension || (OfficeExtension={}));
  10324. var OfficeExtension;
  10325. (function (OfficeExtension) {
  10326. var OfficeJsRequestExecutor=(function () {
  10327. function OfficeJsRequestExecutor() {
  10328. }
  10329. OfficeJsRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  10330. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, OfficeJsRequestExecutor.SourceLibHeaderValue);
  10331. return new OfficeExtension.Promise(function (resolve, reject) {
  10332. OSF.DDA.RichApi.executeRichApiRequestAsync(messageSafearray, function (result) {
  10333. OfficeExtension.Utility.log("Response:");
  10334. OfficeExtension.Utility.log(JSON.stringify(result));
  10335. var response;
  10336. if (result.status=="succeeded") {
  10337. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBody(result), OfficeExtension.RichApiMessageUtility.getResponseHeaders(result));
  10338. }
  10339. else {
  10340. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.code, result.error.message);
  10341. }
  10342. resolve(response);
  10343. });
  10344. });
  10345. };
  10346. OfficeJsRequestExecutor.SourceLibHeaderValue="officejs";
  10347. return OfficeJsRequestExecutor;
  10348. })();
  10349. OfficeExtension.OfficeJsRequestExecutor=OfficeJsRequestExecutor;
  10350. })(OfficeExtension || (OfficeExtension={}));
  10351. var OfficeExtension;
  10352. (function (OfficeExtension) {
  10353. var _Internal;
  10354. (function (_Internal) {
  10355. var PromiseImpl;
  10356. (function (PromiseImpl) {
  10357. function Init() {
  10358. (function () {
  10359. "use strict";
  10360. function lib$es6$promise$utils$$objectOrFunction(x) {
  10361. return typeof x==='function' || (typeof x==='object' && x !==null);
  10362. }
  10363. function lib$es6$promise$utils$$isFunction(x) {
  10364. return typeof x==='function';
  10365. }
  10366. function lib$es6$promise$utils$$isMaybeThenable(x) {
  10367. return typeof x==='object' && x !==null;
  10368. }
  10369. var lib$es6$promise$utils$$_isArray;
  10370. if (!Array.isArray) {
  10371. lib$es6$promise$utils$$_isArray=function (x) {
  10372. return Object.prototype.toString.call(x)==='[object Array]';
  10373. };
  10374. }
  10375. else {
  10376. lib$es6$promise$utils$$_isArray=Array.isArray;
  10377. }
  10378. var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;
  10379. var lib$es6$promise$asap$$len=0;
  10380. var lib$es6$promise$asap$$toString={}.toString;
  10381. var lib$es6$promise$asap$$vertxNext;
  10382. var lib$es6$promise$asap$$customSchedulerFn;
  10383. var lib$es6$promise$asap$$asap=function asap(callback, arg) {
  10384. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;
  10385. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;
  10386. lib$es6$promise$asap$$len+=2;
  10387. if (lib$es6$promise$asap$$len===2) {
  10388. if (lib$es6$promise$asap$$customSchedulerFn) {
  10389. lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
  10390. }
  10391. else {
  10392. lib$es6$promise$asap$$scheduleFlush();
  10393. }
  10394. }
  10395. };
  10396. function lib$es6$promise$asap$$setScheduler(scheduleFn) {
  10397. lib$es6$promise$asap$$customSchedulerFn=scheduleFn;
  10398. }
  10399. function lib$es6$promise$asap$$setAsap(asapFn) {
  10400. lib$es6$promise$asap$$asap=asapFn;
  10401. }
  10402. var lib$es6$promise$asap$$browserWindow=(typeof window !=='undefined') ? window : undefined;
  10403. var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow || {};
  10404. var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
  10405. var lib$es6$promise$asap$$isNode=typeof process !=='undefined' && {}.toString.call(process)==='[object process]';
  10406. var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray !=='undefined' && typeof importScripts !=='undefined' && typeof MessageChannel !=='undefined';
  10407. function lib$es6$promise$asap$$useNextTick() {
  10408. var nextTick=process.nextTick;
  10409. var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
  10410. if (Array.isArray(version) && version[1]==='0' && version[2]==='10') {
  10411. nextTick=setImmediate;
  10412. }
  10413. return function () {
  10414. nextTick(lib$es6$promise$asap$$flush);
  10415. };
  10416. }
  10417. function lib$es6$promise$asap$$useVertxTimer() {
  10418. return function () {
  10419. lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
  10420. };
  10421. }
  10422. function lib$es6$promise$asap$$useMutationObserver() {
  10423. var iterations=0;
  10424. var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
  10425. var node=document.createTextNode('');
  10426. observer.observe(node, { characterData: true });
  10427. return function () {
  10428. node.data=(iterations=++iterations % 2);
  10429. };
  10430. }
  10431. function lib$es6$promise$asap$$useMessageChannel() {
  10432. var channel=new MessageChannel();
  10433. channel.port1.onmessage=lib$es6$promise$asap$$flush;
  10434. return function () {
  10435. channel.port2.postMessage(0);
  10436. };
  10437. }
  10438. function lib$es6$promise$asap$$useSetTimeout() {
  10439. return function () {
  10440. setTimeout(lib$es6$promise$asap$$flush, 1);
  10441. };
  10442. }
  10443. var lib$es6$promise$asap$$queue=new Array(1000);
  10444. function lib$es6$promise$asap$$flush() {
  10445. for (var i=0; i < lib$es6$promise$asap$$len; i+=2) {
  10446. var callback=lib$es6$promise$asap$$queue[i];
  10447. var arg=lib$es6$promise$asap$$queue[i+1];
  10448. callback(arg);
  10449. lib$es6$promise$asap$$queue[i]=undefined;
  10450. lib$es6$promise$asap$$queue[i+1]=undefined;
  10451. }
  10452. lib$es6$promise$asap$$len=0;
  10453. }
  10454. function lib$es6$promise$asap$$attemptVertex() {
  10455. try {
  10456. var r=require;
  10457. var vertx=r('vertx');
  10458. lib$es6$promise$asap$$vertxNext=vertx.runOnLoop || vertx.runOnContext;
  10459. return lib$es6$promise$asap$$useVertxTimer();
  10460. }
  10461. catch (e) {
  10462. return lib$es6$promise$asap$$useSetTimeout();
  10463. }
  10464. }
  10465. var lib$es6$promise$asap$$scheduleFlush;
  10466. if (lib$es6$promise$asap$$isNode) {
  10467. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useNextTick();
  10468. }
  10469. else if (lib$es6$promise$asap$$BrowserMutationObserver) {
  10470. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMutationObserver();
  10471. }
  10472. else if (lib$es6$promise$asap$$isWorker) {
  10473. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMessageChannel();
  10474. }
  10475. else if (lib$es6$promise$asap$$browserWindow===undefined && typeof require==='function') {
  10476. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$attemptVertex();
  10477. }
  10478. else {
  10479. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useSetTimeout();
  10480. }
  10481. function lib$es6$promise$$internal$$noop() {
  10482. }
  10483. var lib$es6$promise$$internal$$PENDING=void 0;
  10484. var lib$es6$promise$$internal$$FULFILLED=1;
  10485. var lib$es6$promise$$internal$$REJECTED=2;
  10486. var lib$es6$promise$$internal$$GET_THEN_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  10487. function lib$es6$promise$$internal$$selfFullfillment() {
  10488. return new TypeError("You cannot resolve a promise with itself");
  10489. }
  10490. function lib$es6$promise$$internal$$cannotReturnOwn() {
  10491. return new TypeError('A promises callback cannot return that same promise.');
  10492. }
  10493. function lib$es6$promise$$internal$$getThen(promise) {
  10494. try {
  10495. return promise.then;
  10496. }
  10497. catch (error) {
  10498. lib$es6$promise$$internal$$GET_THEN_ERROR.error=error;
  10499. return lib$es6$promise$$internal$$GET_THEN_ERROR;
  10500. }
  10501. }
  10502. function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  10503. try {
  10504. then.call(value, fulfillmentHandler, rejectionHandler);
  10505. }
  10506. catch (e) {
  10507. return e;
  10508. }
  10509. }
  10510. function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
  10511. lib$es6$promise$asap$$asap(function (promise) {
  10512. var sealed=false;
  10513. var error=lib$es6$promise$$internal$$tryThen(then, thenable, function (value) {
  10514. if (sealed) {
  10515. return;
  10516. }
  10517. sealed=true;
  10518. if (thenable !==value) {
  10519. lib$es6$promise$$internal$$resolve(promise, value);
  10520. }
  10521. else {
  10522. lib$es6$promise$$internal$$fulfill(promise, value);
  10523. }
  10524. }, function (reason) {
  10525. if (sealed) {
  10526. return;
  10527. }
  10528. sealed=true;
  10529. lib$es6$promise$$internal$$reject(promise, reason);
  10530. }, 'Settle: '+(promise._label || ' unknown promise'));
  10531. if (!sealed && error) {
  10532. sealed=true;
  10533. lib$es6$promise$$internal$$reject(promise, error);
  10534. }
  10535. }, promise);
  10536. }
  10537. function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
  10538. if (thenable._state===lib$es6$promise$$internal$$FULFILLED) {
  10539. lib$es6$promise$$internal$$fulfill(promise, thenable._result);
  10540. }
  10541. else if (thenable._state===lib$es6$promise$$internal$$REJECTED) {
  10542. lib$es6$promise$$internal$$reject(promise, thenable._result);
  10543. }
  10544. else {
  10545. lib$es6$promise$$internal$$subscribe(thenable, undefined, function (value) {
  10546. lib$es6$promise$$internal$$resolve(promise, value);
  10547. }, function (reason) {
  10548. lib$es6$promise$$internal$$reject(promise, reason);
  10549. });
  10550. }
  10551. }
  10552. function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
  10553. if (maybeThenable.constructor===promise.constructor) {
  10554. lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
  10555. }
  10556. else {
  10557. var then=lib$es6$promise$$internal$$getThen(maybeThenable);
  10558. if (then===lib$es6$promise$$internal$$GET_THEN_ERROR) {
  10559. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
  10560. }
  10561. else if (then===undefined) {
  10562. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  10563. }
  10564. else if (lib$es6$promise$utils$$isFunction(then)) {
  10565. lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
  10566. }
  10567. else {
  10568. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  10569. }
  10570. }
  10571. }
  10572. function lib$es6$promise$$internal$$resolve(promise, value) {
  10573. if (promise===value) {
  10574. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
  10575. }
  10576. else if (lib$es6$promise$utils$$objectOrFunction(value)) {
  10577. lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
  10578. }
  10579. else {
  10580. lib$es6$promise$$internal$$fulfill(promise, value);
  10581. }
  10582. }
  10583. function lib$es6$promise$$internal$$publishRejection(promise) {
  10584. if (promise._onerror) {
  10585. promise._onerror(promise._result);
  10586. }
  10587. lib$es6$promise$$internal$$publish(promise);
  10588. }
  10589. function lib$es6$promise$$internal$$fulfill(promise, value) {
  10590. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  10591. return;
  10592. }
  10593. promise._result=value;
  10594. promise._state=lib$es6$promise$$internal$$FULFILLED;
  10595. if (promise._subscribers.length !==0) {
  10596. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
  10597. }
  10598. }
  10599. function lib$es6$promise$$internal$$reject(promise, reason) {
  10600. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  10601. return;
  10602. }
  10603. promise._state=lib$es6$promise$$internal$$REJECTED;
  10604. promise._result=reason;
  10605. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
  10606. }
  10607. function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
  10608. var subscribers=parent._subscribers;
  10609. var length=subscribers.length;
  10610. parent._onerror=null;
  10611. subscribers[length]=child;
  10612. subscribers[length+lib$es6$promise$$internal$$FULFILLED]=onFulfillment;
  10613. subscribers[length+lib$es6$promise$$internal$$REJECTED]=onRejection;
  10614. if (length===0 && parent._state) {
  10615. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
  10616. }
  10617. }
  10618. function lib$es6$promise$$internal$$publish(promise) {
  10619. var subscribers=promise._subscribers;
  10620. var settled=promise._state;
  10621. if (subscribers.length===0) {
  10622. return;
  10623. }
  10624. var child, callback, detail=promise._result;
  10625. for (var i=0; i < subscribers.length; i+=3) {
  10626. child=subscribers[i];
  10627. callback=subscribers[i+settled];
  10628. if (child) {
  10629. lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
  10630. }
  10631. else {
  10632. callback(detail);
  10633. }
  10634. }
  10635. promise._subscribers.length=0;
  10636. }
  10637. function lib$es6$promise$$internal$$ErrorObject() {
  10638. this.error=null;
  10639. }
  10640. var lib$es6$promise$$internal$$TRY_CATCH_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  10641. function lib$es6$promise$$internal$$tryCatch(callback, detail) {
  10642. try {
  10643. return callback(detail);
  10644. }
  10645. catch (e) {
  10646. lib$es6$promise$$internal$$TRY_CATCH_ERROR.error=e;
  10647. return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
  10648. }
  10649. }
  10650. function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
  10651. var hasCallback=lib$es6$promise$utils$$isFunction(callback), value, error, succeeded, failed;
  10652. if (hasCallback) {
  10653. value=lib$es6$promise$$internal$$tryCatch(callback, detail);
  10654. if (value===lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
  10655. failed=true;
  10656. error=value.error;
  10657. value=null;
  10658. }
  10659. else {
  10660. succeeded=true;
  10661. }
  10662. if (promise===value) {
  10663. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
  10664. return;
  10665. }
  10666. }
  10667. else {
  10668. value=detail;
  10669. succeeded=true;
  10670. }
  10671. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  10672. }
  10673. else if (hasCallback && succeeded) {
  10674. lib$es6$promise$$internal$$resolve(promise, value);
  10675. }
  10676. else if (failed) {
  10677. lib$es6$promise$$internal$$reject(promise, error);
  10678. }
  10679. else if (settled===lib$es6$promise$$internal$$FULFILLED) {
  10680. lib$es6$promise$$internal$$fulfill(promise, value);
  10681. }
  10682. else if (settled===lib$es6$promise$$internal$$REJECTED) {
  10683. lib$es6$promise$$internal$$reject(promise, value);
  10684. }
  10685. }
  10686. function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
  10687. try {
  10688. resolver(function resolvePromise(value) {
  10689. lib$es6$promise$$internal$$resolve(promise, value);
  10690. }, function rejectPromise(reason) {
  10691. lib$es6$promise$$internal$$reject(promise, reason);
  10692. });
  10693. }
  10694. catch (e) {
  10695. lib$es6$promise$$internal$$reject(promise, e);
  10696. }
  10697. }
  10698. function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
  10699. var enumerator=this;
  10700. enumerator._instanceConstructor=Constructor;
  10701. enumerator.promise=new Constructor(lib$es6$promise$$internal$$noop);
  10702. if (enumerator._validateInput(input)) {
  10703. enumerator._input=input;
  10704. enumerator.length=input.length;
  10705. enumerator._remaining=input.length;
  10706. enumerator._init();
  10707. if (enumerator.length===0) {
  10708. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  10709. }
  10710. else {
  10711. enumerator.length=enumerator.length || 0;
  10712. enumerator._enumerate();
  10713. if (enumerator._remaining===0) {
  10714. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  10715. }
  10716. }
  10717. }
  10718. else {
  10719. lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
  10720. }
  10721. }
  10722. lib$es6$promise$enumerator$$Enumerator.prototype._validateInput=function (input) {
  10723. return lib$es6$promise$utils$$isArray(input);
  10724. };
  10725. lib$es6$promise$enumerator$$Enumerator.prototype._validationError=function () {
  10726. return new _Internal.Error('Array Methods must be provided an Array');
  10727. };
  10728. lib$es6$promise$enumerator$$Enumerator.prototype._init=function () {
  10729. this._result=new Array(this.length);
  10730. };
  10731. var lib$es6$promise$enumerator$$default=lib$es6$promise$enumerator$$Enumerator;
  10732. lib$es6$promise$enumerator$$Enumerator.prototype._enumerate=function () {
  10733. var enumerator=this;
  10734. var length=enumerator.length;
  10735. var promise=enumerator.promise;
  10736. var input=enumerator._input;
  10737. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  10738. enumerator._eachEntry(input[i], i);
  10739. }
  10740. };
  10741. lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry=function (entry, i) {
  10742. var enumerator=this;
  10743. var c=enumerator._instanceConstructor;
  10744. if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
  10745. if (entry.constructor===c && entry._state !==lib$es6$promise$$internal$$PENDING) {
  10746. entry._onerror=null;
  10747. enumerator._settledAt(entry._state, i, entry._result);
  10748. }
  10749. else {
  10750. enumerator._willSettleAt(c.resolve(entry), i);
  10751. }
  10752. }
  10753. else {
  10754. enumerator._remaining--;
  10755. enumerator._result[i]=entry;
  10756. }
  10757. };
  10758. lib$es6$promise$enumerator$$Enumerator.prototype._settledAt=function (state, i, value) {
  10759. var enumerator=this;
  10760. var promise=enumerator.promise;
  10761. if (promise._state===lib$es6$promise$$internal$$PENDING) {
  10762. enumerator._remaining--;
  10763. if (state===lib$es6$promise$$internal$$REJECTED) {
  10764. lib$es6$promise$$internal$$reject(promise, value);
  10765. }
  10766. else {
  10767. enumerator._result[i]=value;
  10768. }
  10769. }
  10770. if (enumerator._remaining===0) {
  10771. lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
  10772. }
  10773. };
  10774. lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt=function (promise, i) {
  10775. var enumerator=this;
  10776. lib$es6$promise$$internal$$subscribe(promise, undefined, function (value) {
  10777. enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
  10778. }, function (reason) {
  10779. enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
  10780. });
  10781. };
  10782. function lib$es6$promise$promise$all$$all(entries) {
  10783. return new lib$es6$promise$enumerator$$default(this, entries).promise;
  10784. }
  10785. var lib$es6$promise$promise$all$$default=lib$es6$promise$promise$all$$all;
  10786. function lib$es6$promise$promise$race$$race(entries) {
  10787. var Constructor=this;
  10788. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  10789. if (!lib$es6$promise$utils$$isArray(entries)) {
  10790. lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
  10791. return promise;
  10792. }
  10793. var length=entries.length;
  10794. function onFulfillment(value) {
  10795. lib$es6$promise$$internal$$resolve(promise, value);
  10796. }
  10797. function onRejection(reason) {
  10798. lib$es6$promise$$internal$$reject(promise, reason);
  10799. }
  10800. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  10801. lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
  10802. }
  10803. return promise;
  10804. }
  10805. var lib$es6$promise$promise$race$$default=lib$es6$promise$promise$race$$race;
  10806. function lib$es6$promise$promise$resolve$$resolve(object) {
  10807. var Constructor=this;
  10808. if (object && typeof object==='object' && object.constructor===Constructor) {
  10809. return object;
  10810. }
  10811. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  10812. lib$es6$promise$$internal$$resolve(promise, object);
  10813. return promise;
  10814. }
  10815. var lib$es6$promise$promise$resolve$$default=lib$es6$promise$promise$resolve$$resolve;
  10816. function lib$es6$promise$promise$reject$$reject(reason) {
  10817. var Constructor=this;
  10818. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  10819. lib$es6$promise$$internal$$reject(promise, reason);
  10820. return promise;
  10821. }
  10822. var lib$es6$promise$promise$reject$$default=lib$es6$promise$promise$reject$$reject;
  10823. var lib$es6$promise$promise$$counter=0;
  10824. function lib$es6$promise$promise$$needsResolver() {
  10825. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  10826. }
  10827. function lib$es6$promise$promise$$needsNew() {
  10828. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  10829. }
  10830. var lib$es6$promise$promise$$default=lib$es6$promise$promise$$Promise;
  10831. function lib$es6$promise$promise$$Promise(resolver) {
  10832. this._id=lib$es6$promise$promise$$counter++;
  10833. this._state=undefined;
  10834. this._result=undefined;
  10835. this._subscribers=[];
  10836. if (lib$es6$promise$$internal$$noop !==resolver) {
  10837. if (!lib$es6$promise$utils$$isFunction(resolver)) {
  10838. lib$es6$promise$promise$$needsResolver();
  10839. }
  10840. if (!(this instanceof lib$es6$promise$promise$$Promise)) {
  10841. lib$es6$promise$promise$$needsNew();
  10842. }
  10843. lib$es6$promise$$internal$$initializePromise(this, resolver);
  10844. }
  10845. }
  10846. lib$es6$promise$promise$$Promise.all=lib$es6$promise$promise$all$$default;
  10847. lib$es6$promise$promise$$Promise.race=lib$es6$promise$promise$race$$default;
  10848. lib$es6$promise$promise$$Promise.resolve=lib$es6$promise$promise$resolve$$default;
  10849. lib$es6$promise$promise$$Promise.reject=lib$es6$promise$promise$reject$$default;
  10850. lib$es6$promise$promise$$Promise._setScheduler=lib$es6$promise$asap$$setScheduler;
  10851. lib$es6$promise$promise$$Promise._setAsap=lib$es6$promise$asap$$setAsap;
  10852. lib$es6$promise$promise$$Promise._asap=lib$es6$promise$asap$$asap;
  10853. lib$es6$promise$promise$$Promise.prototype={
  10854. constructor: lib$es6$promise$promise$$Promise,
  10855. then: function (onFulfillment, onRejection) {
  10856. var parent=this;
  10857. var state=parent._state;
  10858. if (state===lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state===lib$es6$promise$$internal$$REJECTED && !onRejection) {
  10859. return this;
  10860. }
  10861. var child=new this.constructor(lib$es6$promise$$internal$$noop);
  10862. var result=parent._result;
  10863. if (state) {
  10864. var callback=arguments[state - 1];
  10865. lib$es6$promise$asap$$asap(function () {
  10866. lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
  10867. });
  10868. }
  10869. else {
  10870. lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
  10871. }
  10872. return child;
  10873. },
  10874. 'catch': function (onRejection) {
  10875. return this.then(null, onRejection);
  10876. }
  10877. };
  10878. OfficeExtension.Promise=lib$es6$promise$promise$$default;
  10879. }).call(this);
  10880. }
  10881. PromiseImpl.Init=Init;
  10882. })(PromiseImpl=_Internal.PromiseImpl || (_Internal.PromiseImpl={}));
  10883. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  10884. if (!OfficeExtension["Promise"]) {
  10885. if (typeof (window) !=="undefined" && window.Promise) {
  10886. if (IsEdgeLessThan14()) {
  10887. _Internal.PromiseImpl.Init();
  10888. }
  10889. else {
  10890. OfficeExtension.Promise=window.Promise;
  10891. }
  10892. }
  10893. else {
  10894. _Internal.PromiseImpl.Init();
  10895. }
  10896. }
  10897. })(OfficeExtension || (OfficeExtension={}));
  10898. function IsEdgeLessThan14() {
  10899. var userAgent=window.navigator.userAgent;
  10900. var versionIdx=userAgent.indexOf("Edge/");
  10901. if (versionIdx >=0) {
  10902. userAgent=userAgent.substring(versionIdx+5, userAgent.length);
  10903. if (userAgent < "14.14393")
  10904. return true;
  10905. else
  10906. return false;
  10907. }
  10908. return false;
  10909. }
  10910. var OfficeExtension;
  10911. (function (OfficeExtension) {
  10912. (function (OperationType) {
  10913. OperationType[OperationType["Default"]=0]="Default";
  10914. OperationType[OperationType["Read"]=1]="Read";
  10915. })(OfficeExtension.OperationType || (OfficeExtension.OperationType={}));
  10916. var OperationType=OfficeExtension.OperationType;
  10917. })(OfficeExtension || (OfficeExtension={}));
  10918. var OfficeExtension;
  10919. (function (OfficeExtension) {
  10920. var TrackedObjects=(function () {
  10921. function TrackedObjects(context) {
  10922. this._autoCleanupList={};
  10923. this.m_context=context;
  10924. }
  10925. TrackedObjects.prototype.add=function (param) {
  10926. var _this=this;
  10927. if (Array.isArray(param)) {
  10928. param.forEach(function (item) { return _this._addCommon(item, true); });
  10929. }
  10930. else {
  10931. this._addCommon(param, true);
  10932. }
  10933. };
  10934. TrackedObjects.prototype._autoAdd=function (object) {
  10935. this._addCommon(object, false);
  10936. this._autoCleanupList[object._objectPath.objectPathInfo.Id]=object;
  10937. };
  10938. TrackedObjects.prototype._addCommon=function (object, isExplicitlyAdded) {
  10939. if (object[OfficeExtension.Constants.isTracked]) {
  10940. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  10941. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  10942. }
  10943. return;
  10944. }
  10945. var referenceId=object[OfficeExtension.Constants.referenceId];
  10946. if (OfficeExtension.Utility.isNullOrEmptyString(referenceId) && object._KeepReference) {
  10947. object._KeepReference();
  10948. OfficeExtension.ActionFactory.createInstantiateAction(this.m_context, object);
  10949. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  10950. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  10951. }
  10952. object[OfficeExtension.Constants.isTracked]=true;
  10953. }
  10954. };
  10955. TrackedObjects.prototype.remove=function (param) {
  10956. var _this=this;
  10957. if (Array.isArray(param)) {
  10958. param.forEach(function (item) { return _this._removeCommon(item); });
  10959. }
  10960. else {
  10961. this._removeCommon(param);
  10962. }
  10963. };
  10964. TrackedObjects.prototype._removeCommon=function (object) {
  10965. var referenceId=object[OfficeExtension.Constants.referenceId];
  10966. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  10967. var rootObject=this.m_context._rootObject;
  10968. if (rootObject._RemoveReference) {
  10969. rootObject._RemoveReference(referenceId);
  10970. }
  10971. delete object[OfficeExtension.Constants.isTracked];
  10972. }
  10973. };
  10974. TrackedObjects.prototype._retrieveAndClearAutoCleanupList=function () {
  10975. var list=this._autoCleanupList;
  10976. this._autoCleanupList={};
  10977. return list;
  10978. };
  10979. return TrackedObjects;
  10980. })();
  10981. OfficeExtension.TrackedObjects=TrackedObjects;
  10982. })(OfficeExtension || (OfficeExtension={}));
  10983. var OfficeExtension;
  10984. (function (OfficeExtension) {
  10985. var ResourceStrings=(function () {
  10986. function ResourceStrings() {
  10987. }
  10988. ResourceStrings.invalidObjectPath="InvalidObjectPath";
  10989. ResourceStrings.propertyNotLoaded="PropertyNotLoaded";
  10990. ResourceStrings.valueNotLoaded="ValueNotLoaded";
  10991. ResourceStrings.invalidRequestContext="InvalidRequestContext";
  10992. ResourceStrings.invalidArgument="InvalidArgument";
  10993. ResourceStrings.runMustReturnPromise="RunMustReturnPromise";
  10994. ResourceStrings.cannotRegisterEvent="CannotRegisterEvent";
  10995. ResourceStrings.connectionFailureWithStatus="ConnectionFailureWithStatus";
  10996. ResourceStrings.connectionFailureWithDetails="ConnectionFailureWithDetails";
  10997. return ResourceStrings;
  10998. })();
  10999. OfficeExtension.ResourceStrings=ResourceStrings;
  11000. })(OfficeExtension || (OfficeExtension={}));
  11001. var OfficeExtension;
  11002. (function (OfficeExtension) {
  11003. var RichApiMessageUtility=(function () {
  11004. function RichApiMessageUtility() {
  11005. }
  11006. RichApiMessageUtility.buildMessageArrayForIRequestExecutor=function (customData, requestFlags, requestMessage, sourceLibHeaderValue) {
  11007. var requestMessageText=JSON.stringify(requestMessage.Body);
  11008. OfficeExtension.Utility.log("Request:");
  11009. OfficeExtension.Utility.log(requestMessageText);
  11010. var headers={};
  11011. headers[OfficeExtension.Constants.sourceLibHeader]=sourceLibHeaderValue;
  11012. var messageSafearray=RichApiMessageUtility.buildRequestMessageSafeArray(customData, requestFlags, "POST", "ProcessQuery", headers, requestMessageText);
  11013. return messageSafearray;
  11014. };
  11015. RichApiMessageUtility.buildResponseOnSuccess=function (responseBody, responseHeaders) {
  11016. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  11017. response.Body=JSON.parse(responseBody);
  11018. response.Headers=responseHeaders;
  11019. return response;
  11020. };
  11021. RichApiMessageUtility.buildResponseOnError=function (errorCode, message) {
  11022. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  11023. response.ErrorCode=OfficeExtension.ErrorCodes.generalException;
  11024. if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  11025. response.ErrorCode=OfficeExtension.ErrorCodes.accessDenied;
  11026. }
  11027. else if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  11028. response.ErrorCode=OfficeExtension.ErrorCodes.activityLimitReached;
  11029. }
  11030. response.ErrorMessage=message;
  11031. return response;
  11032. };
  11033. RichApiMessageUtility.buildHttpResponseFromOfficeJsError=function (errorCode, message) {
  11034. var statusCode=500;
  11035. var errorBody={};
  11036. errorBody["error"]={};
  11037. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.generalException;
  11038. errorBody["error"]["message"]=message;
  11039. if (errorCode===RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  11040. statusCode=403;
  11041. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.accessDenied;
  11042. }
  11043. else if (errorCode===RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  11044. statusCode=429;
  11045. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.activityLimitReached;
  11046. }
  11047. return { statusCode: statusCode, headers: {}, body: JSON.stringify(errorBody) };
  11048. };
  11049. RichApiMessageUtility.buildRequestMessageSafeArray=function (customData, requestFlags, method, path, headers, body) {
  11050. var headerArray=[];
  11051. if (headers) {
  11052. for (var headerName in headers) {
  11053. headerArray.push(headerName);
  11054. headerArray.push(headers[headerName]);
  11055. }
  11056. }
  11057. var appPermission=0;
  11058. var solutionId="";
  11059. var instanceId="";
  11060. var marketplaceType="";
  11061. return [
  11062. customData,
  11063. method,
  11064. path,
  11065. headerArray,
  11066. body,
  11067. appPermission,
  11068. requestFlags,
  11069. solutionId,
  11070. instanceId,
  11071. marketplaceType
  11072. ];
  11073. };
  11074. RichApiMessageUtility.getResponseBody=function (result) {
  11075. return RichApiMessageUtility.getResponseBodyFromSafeArray(result.value.data);
  11076. };
  11077. RichApiMessageUtility.getResponseHeaders=function (result) {
  11078. return RichApiMessageUtility.getResponseHeadersFromSafeArray(result.value.data);
  11079. };
  11080. RichApiMessageUtility.getResponseBodyFromSafeArray=function (data) {
  11081. var ret=data[2 ];
  11082. if (typeof (ret)==="string") {
  11083. return ret;
  11084. }
  11085. var arr=ret;
  11086. return arr.join("");
  11087. };
  11088. RichApiMessageUtility.getResponseHeadersFromSafeArray=function (data) {
  11089. var arrayHeader=data[1 ];
  11090. if (!arrayHeader) {
  11091. return null;
  11092. }
  11093. var headers={};
  11094. for (var i=0; i < arrayHeader.length - 1; i+=2) {
  11095. headers[arrayHeader[i]]=arrayHeader[i+1];
  11096. }
  11097. return headers;
  11098. };
  11099. RichApiMessageUtility.getResponseStatusCode=function (result) {
  11100. return RichApiMessageUtility.getResponseStatusCodeFromSafeArray(result.value.data);
  11101. };
  11102. RichApiMessageUtility.getResponseStatusCodeFromSafeArray=function (data) {
  11103. return data[0 ];
  11104. };
  11105. RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability=7000;
  11106. RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached=5102;
  11107. return RichApiMessageUtility;
  11108. })();
  11109. OfficeExtension.RichApiMessageUtility=RichApiMessageUtility;
  11110. })(OfficeExtension || (OfficeExtension={}));
  11111. var OfficeExtension;
  11112. (function (OfficeExtension) {
  11113. var Utility=(function () {
  11114. function Utility() {
  11115. }
  11116. Utility.checkArgumentNull=function (value, name) {
  11117. if (Utility.isNullOrUndefined(value)) {
  11118. Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, name);
  11119. }
  11120. };
  11121. Utility.isNullOrUndefined=function (value) {
  11122. if (value===null) {
  11123. return true;
  11124. }
  11125. if (typeof (value)==="undefined") {
  11126. return true;
  11127. }
  11128. return false;
  11129. };
  11130. Utility.isUndefined=function (value) {
  11131. if (typeof (value)==="undefined") {
  11132. return true;
  11133. }
  11134. return false;
  11135. };
  11136. Utility.isNullOrEmptyString=function (value) {
  11137. if (value===null) {
  11138. return true;
  11139. }
  11140. if (typeof (value)==="undefined") {
  11141. return true;
  11142. }
  11143. if (value.length==0) {
  11144. return true;
  11145. }
  11146. return false;
  11147. };
  11148. Utility.isPlainJsonObject=function (value) {
  11149. if (Utility.isNullOrUndefined(value)) {
  11150. return false;
  11151. }
  11152. if (typeof (value) !=="object") {
  11153. return false;
  11154. }
  11155. return Object.getPrototypeOf(value)===Object.getPrototypeOf({});
  11156. };
  11157. Utility.trim=function (str) {
  11158. return str.replace(new RegExp("^\\s+|\\s+$", "g"), "");
  11159. };
  11160. Utility.caseInsensitiveCompareString=function (str1, str2) {
  11161. if (Utility.isNullOrUndefined(str1)) {
  11162. return Utility.isNullOrUndefined(str2);
  11163. }
  11164. else {
  11165. if (Utility.isNullOrUndefined(str2)) {
  11166. return false;
  11167. }
  11168. else {
  11169. return str1.toUpperCase()==str2.toUpperCase();
  11170. }
  11171. }
  11172. };
  11173. Utility.adjustToDateTime=function (value) {
  11174. if (Utility.isNullOrUndefined(value)) {
  11175. return null;
  11176. }
  11177. if (typeof (value)==="string") {
  11178. return new Date(value);
  11179. }
  11180. if (Array.isArray(value)) {
  11181. var arr=value;
  11182. for (var i=0; i < arr.length; i++) {
  11183. arr[i]=Utility.adjustToDateTime(arr[i]);
  11184. }
  11185. return arr;
  11186. }
  11187. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "date"), null);
  11188. };
  11189. Utility.isReadonlyRestRequest=function (method) {
  11190. return Utility.caseInsensitiveCompareString(method, "GET");
  11191. };
  11192. Utility.setMethodArguments=function (context, argumentInfo, args) {
  11193. if (Utility.isNullOrUndefined(args)) {
  11194. return null;
  11195. }
  11196. var referencedObjectPaths=new Array();
  11197. var referencedObjectPathIds=new Array();
  11198. var hasOne=Utility.collectObjectPathInfos(context, args, referencedObjectPaths, referencedObjectPathIds);
  11199. argumentInfo.Arguments=args;
  11200. if (hasOne) {
  11201. argumentInfo.ReferencedObjectPathIds=referencedObjectPathIds;
  11202. return referencedObjectPaths;
  11203. }
  11204. return null;
  11205. };
  11206. Utility.collectObjectPathInfos=function (context, args, referencedObjectPaths, referencedObjectPathIds) {
  11207. var hasOne=false;
  11208. for (var i=0; i < args.length; i++) {
  11209. if (args[i] instanceof OfficeExtension.ClientObject) {
  11210. var clientObject=args[i];
  11211. Utility.validateContext(context, clientObject);
  11212. args[i]=clientObject._objectPath.objectPathInfo.Id;
  11213. referencedObjectPathIds.push(clientObject._objectPath.objectPathInfo.Id);
  11214. referencedObjectPaths.push(clientObject._objectPath);
  11215. hasOne=true;
  11216. }
  11217. else if (Array.isArray(args[i])) {
  11218. var childArrayObjectPathIds=new Array();
  11219. var childArrayHasOne=Utility.collectObjectPathInfos(context, args[i], referencedObjectPaths, childArrayObjectPathIds);
  11220. if (childArrayHasOne) {
  11221. referencedObjectPathIds.push(childArrayObjectPathIds);
  11222. hasOne=true;
  11223. }
  11224. else {
  11225. referencedObjectPathIds.push(0);
  11226. }
  11227. }
  11228. else {
  11229. referencedObjectPathIds.push(0);
  11230. }
  11231. }
  11232. return hasOne;
  11233. };
  11234. Utility.fixObjectPathIfNecessary=function (clientObject, value) {
  11235. if (clientObject && clientObject._objectPath && value) {
  11236. clientObject._objectPath.updateUsingObjectData(value);
  11237. }
  11238. };
  11239. Utility.validateObjectPath=function (clientObject) {
  11240. var objectPath=clientObject._objectPath;
  11241. while (objectPath) {
  11242. if (!objectPath.isValid) {
  11243. var pathExpression=Utility.getObjectPathExpression(objectPath);
  11244. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  11245. }
  11246. objectPath=objectPath.parentObjectPath;
  11247. }
  11248. };
  11249. Utility.validateReferencedObjectPaths=function (objectPaths) {
  11250. if (objectPaths) {
  11251. for (var i=0; i < objectPaths.length; i++) {
  11252. var objectPath=objectPaths[i];
  11253. while (objectPath) {
  11254. if (!objectPath.isValid) {
  11255. var pathExpression=Utility.getObjectPathExpression(objectPath);
  11256. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  11257. }
  11258. objectPath=objectPath.parentObjectPath;
  11259. }
  11260. }
  11261. }
  11262. };
  11263. Utility.validateContext=function (context, obj) {
  11264. if (obj && obj.context !==context) {
  11265. Utility.throwError(OfficeExtension.ResourceStrings.invalidRequestContext);
  11266. }
  11267. };
  11268. Utility.log=function (message) {
  11269. if (Utility._logEnabled && typeof (console) !=="undefined" && console.log) {
  11270. console.log(message);
  11271. }
  11272. };
  11273. Utility.load=function (clientObj, option) {
  11274. clientObj.context.load(clientObj, option);
  11275. };
  11276. Utility._parseSelectExpand=function (select) {
  11277. var args=[];
  11278. if (!Utility.isNullOrEmptyString(select)) {
  11279. var propertyNames=select.split(",");
  11280. for (var i=0; i < propertyNames.length; i++) {
  11281. var propertyName=propertyNames[i];
  11282. propertyName=sanitizeForAnyItemsSlash(propertyName.trim());
  11283. if (propertyName.length > 0) {
  11284. args.push(propertyName);
  11285. }
  11286. }
  11287. }
  11288. return args;
  11289. function sanitizeForAnyItemsSlash(propertyName) {
  11290. var propertyNameLower=propertyName.toLowerCase();
  11291. if (propertyNameLower==="items" || propertyNameLower==="items/") {
  11292. return '*';
  11293. }
  11294. var itemsSlashLength=6;
  11295. if (propertyNameLower.substr(0, itemsSlashLength)==="items/") {
  11296. propertyName=propertyName.substr(itemsSlashLength);
  11297. }
  11298. return propertyName.replace(new RegExp("\/items\/", "gi"), "/");
  11299. }
  11300. };
  11301. Utility.throwError=function (resourceId, arg, errorLocation) {
  11302. throw new OfficeExtension._Internal.RuntimeError(resourceId, Utility._getResourceString(resourceId, arg), new Array(), errorLocation ? { errorLocation: errorLocation } : {});
  11303. };
  11304. Utility.createRuntimeError=function (code, message, location) {
  11305. return new OfficeExtension._Internal.RuntimeError(code, message, [], { errorLocation: location });
  11306. };
  11307. Utility.createInvalidArgumentException=function (name, errorLocation) {
  11308. return Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, name), errorLocation);
  11309. };
  11310. Utility._getResourceString=function (resourceId, arg) {
  11311. var ret=resourceId;
  11312. if (typeof (window) !=="undefined" && window.Strings && window.Strings.OfficeOM) {
  11313. var stringName="L_"+resourceId;
  11314. var stringValue=window.Strings.OfficeOM[stringName];
  11315. if (stringValue) {
  11316. ret=stringValue;
  11317. }
  11318. }
  11319. if (!Utility.isNullOrUndefined(arg)) {
  11320. if (Array.isArray(arg)) {
  11321. var arrArg=arg;
  11322. ret=Utility._formatString(ret, arrArg);
  11323. }
  11324. else {
  11325. ret=ret.replace("{0}", arg);
  11326. }
  11327. }
  11328. return ret;
  11329. };
  11330. Utility._formatString=function (format, arrArg) {
  11331. return format.replace(/\{\d\}/g, function (v) {
  11332. var position=parseInt(v.substr(1, v.length - 2));
  11333. if (position < arrArg.length) {
  11334. return arrArg[position];
  11335. }
  11336. else {
  11337. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "format"), null);
  11338. }
  11339. return "";
  11340. });
  11341. };
  11342. Utility.throwIfNotLoaded=function (propertyName, fieldValue, entityName, isNull) {
  11343. if (!isNull && Utility.isUndefined(fieldValue) && propertyName.charCodeAt(0) !=Utility.s_underscoreCharCode) {
  11344. Utility.throwError(OfficeExtension.ResourceStrings.propertyNotLoaded, propertyName, (entityName ? entityName+"."+propertyName : null));
  11345. }
  11346. };
  11347. Utility.getObjectPathExpression=function (objectPath) {
  11348. var ret="";
  11349. while (objectPath) {
  11350. switch (objectPath.objectPathInfo.ObjectPathType) {
  11351. case 1 :
  11352. ret=ret;
  11353. break;
  11354. case 2 :
  11355. ret="new()"+(ret.length > 0 ? "." : "")+ret;
  11356. break;
  11357. case 3 :
  11358. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+"()"+(ret.length > 0 ? "." : "")+ret;
  11359. break;
  11360. case 4 :
  11361. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+(ret.length > 0 ? "." : "")+ret;
  11362. break;
  11363. case 5 :
  11364. ret="getItem()"+(ret.length > 0 ? "." : "")+ret;
  11365. break;
  11366. case 6 :
  11367. ret="_reference()"+(ret.length > 0 ? "." : "")+ret;
  11368. break;
  11369. }
  11370. objectPath=objectPath.parentObjectPath;
  11371. }
  11372. return ret;
  11373. };
  11374. Utility._createPromiseFromResult=function (value) {
  11375. return new OfficeExtension.Promise(function (resolve, reject) {
  11376. resolve(value);
  11377. });
  11378. };
  11379. Utility._createTimeoutPromise=function (timeout) {
  11380. return new OfficeExtension.Promise(function (resolve, reject) {
  11381. setTimeout(function () {
  11382. resolve(null);
  11383. }, timeout);
  11384. });
  11385. };
  11386. Utility.promisify=function (action) {
  11387. return new OfficeExtension.Promise(function (resolve, reject) {
  11388. var callback=function (result) {
  11389. if (result.status=="failed") {
  11390. reject(result.error);
  11391. }
  11392. else {
  11393. resolve(result.value);
  11394. }
  11395. };
  11396. action(callback);
  11397. });
  11398. };
  11399. Utility._addActionResultHandler=function (clientObj, action, resultHandler) {
  11400. clientObj.context._pendingRequest.addActionResultHandler(action, resultHandler);
  11401. };
  11402. Utility._handleNavigationPropertyResults=function (clientObj, objectValue, propertyNames) {
  11403. for (var i=0; i < propertyNames.length - 1; i+=2) {
  11404. if (!Utility.isUndefined(objectValue[propertyNames[i+1]])) {
  11405. clientObj[propertyNames[i]]._handleResult(objectValue[propertyNames[i+1]]);
  11406. }
  11407. }
  11408. };
  11409. Utility.normalizeName=function (name) {
  11410. return name.substr(0, 1).toLowerCase()+name.substr(1);
  11411. };
  11412. Utility._isLocalDocumentUrl=function (url) {
  11413. return Utility._getLocalDocumentUrlPrefixLength(url) > 0;
  11414. };
  11415. Utility._getLocalDocumentUrlPrefixLength=function (url) {
  11416. var localDocumentPrefixes=["http://document.localhost", "https://document.localhost", "//document.localhost"];
  11417. var urlLower=url.toLowerCase().trim();
  11418. for (var i=0; i < localDocumentPrefixes.length; i++) {
  11419. if (urlLower===localDocumentPrefixes[i]) {
  11420. return localDocumentPrefixes[i].length;
  11421. }
  11422. else if (urlLower.substr(0, localDocumentPrefixes[i].length+1)===localDocumentPrefixes[i]+"/") {
  11423. return localDocumentPrefixes[i].length+1;
  11424. }
  11425. }
  11426. return 0;
  11427. };
  11428. Utility._validateLocalDocumentRequest=function (request) {
  11429. var index=Utility._getLocalDocumentUrlPrefixLength(request.url);
  11430. if (index <=0) {
  11431. throw Utility.createInvalidArgumentException("request");
  11432. }
  11433. var path=request.url.substr(index);
  11434. var pathLower=path.toLowerCase();
  11435. if (pathLower==="_api") {
  11436. path="";
  11437. }
  11438. else if (pathLower.substr(0, "_api/".length)==="_api/") {
  11439. path=path.substr("_api/".length);
  11440. }
  11441. return {
  11442. method: request.method,
  11443. url: path,
  11444. headers: request.headers,
  11445. body: request.body
  11446. };
  11447. };
  11448. Utility._buildRequestMessageSafeArray=function (request) {
  11449. var requestFlags=0 ;
  11450. if (!Utility.isReadonlyRestRequest(request.method)) {
  11451. requestFlags=1 ;
  11452. }
  11453. var requestInfo="";
  11454. if (request.headers) {
  11455. requestInfo=request.headers[OfficeExtension.Constants.requestInfoHeader];
  11456. if (!Utility.isNullOrEmptyString(requestInfo)) {
  11457. var parts=requestInfo.split("&");
  11458. for (var i=0; i < parts.length; i++) {
  11459. var keyvalue=parts[i].split("=");
  11460. if (keyvalue[0]=="flags") {
  11461. var flags=parseInt(keyvalue[1]);
  11462. requestFlags=flags;
  11463. break;
  11464. }
  11465. }
  11466. }
  11467. }
  11468. return OfficeExtension.RichApiMessageUtility.buildRequestMessageSafeArray("", requestFlags, request.method, request.url, request.headers, request.body);
  11469. };
  11470. Utility._parseHttpResponseHeaders=function (allResponseHeaders) {
  11471. var responseHeaders={};
  11472. if (!Utility.isNullOrEmptyString(allResponseHeaders)) {
  11473. var regex=new RegExp("\r?\n");
  11474. var entries=allResponseHeaders.split(regex);
  11475. for (var i=0; i < entries.length; i++) {
  11476. var entry=entries[i];
  11477. if (entry !=null) {
  11478. var index=entry.indexOf(':');
  11479. if (index > 0) {
  11480. var key=entry.substr(0, index);
  11481. var value=entry.substr(index+1);
  11482. key=Utility.trim(key);
  11483. value=Utility.trim(value);
  11484. responseHeaders[key.toUpperCase()]=value;
  11485. }
  11486. }
  11487. }
  11488. }
  11489. return responseHeaders;
  11490. };
  11491. Utility._logEnabled=false;
  11492. Utility._synchronousCleanup=false;
  11493. Utility.s_underscoreCharCode="_".charCodeAt(0);
  11494. return Utility;
  11495. })();
  11496. OfficeExtension.Utility=Utility;
  11497. })(OfficeExtension || (OfficeExtension={}));
  11498. var __extends=(this && this.__extends) || function (d, b) {
  11499. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  11500. function __() { this.constructor=d; }
  11501. d.prototype=b===null ? Object.create(b) : (__.prototype=b.prototype, new __());
  11502. };
  11503. var OneNote;
  11504. (function (OneNote) {
  11505. var _createPropertyObjectPath=OfficeExtension.ObjectPathFactory.createPropertyObjectPath;
  11506. var _createMethodObjectPath=OfficeExtension.ObjectPathFactory.createMethodObjectPath;
  11507. var _createIndexerObjectPath=OfficeExtension.ObjectPathFactory.createIndexerObjectPath;
  11508. var _createNewObjectObjectPath=OfficeExtension.ObjectPathFactory.createNewObjectObjectPath;
  11509. var _createChildItemObjectPathUsingIndexer=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexer;
  11510. var _createChildItemObjectPathUsingGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingGetItemAt;
  11511. var _createChildItemObjectPathUsingIndexerOrGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt;
  11512. var _createMethodAction=OfficeExtension.ActionFactory.createMethodAction;
  11513. var _createSetPropertyAction=OfficeExtension.ActionFactory.createSetPropertyAction;
  11514. var _isNullOrUndefined=OfficeExtension.Utility.isNullOrUndefined;
  11515. var _isUndefined=OfficeExtension.Utility.isUndefined;
  11516. var _throwIfNotLoaded=OfficeExtension.Utility.throwIfNotLoaded;
  11517. var _load=OfficeExtension.Utility.load;
  11518. var _fixObjectPathIfNecessary=OfficeExtension.Utility.fixObjectPathIfNecessary;
  11519. var _addActionResultHandler=OfficeExtension.Utility._addActionResultHandler;
  11520. var _handleNavigationPropertyResults=OfficeExtension.Utility._handleNavigationPropertyResults;
  11521. var _adjustToDateTime=OfficeExtension.Utility.adjustToDateTime;
  11522. var Application=(function (_super) {
  11523. __extends(Application, _super);
  11524. function Application() {
  11525. _super.apply(this, arguments);
  11526. }
  11527. Object.defineProperty(Application.prototype, "notebooks", {
  11528. get: function () {
  11529. if (!this.m_notebooks) {
  11530. this.m_notebooks=new OneNote.NotebookCollection(this.context, _createPropertyObjectPath(this.context, this, "Notebooks", true, false));
  11531. }
  11532. return this.m_notebooks;
  11533. },
  11534. enumerable: true,
  11535. configurable: true
  11536. });
  11537. Object.defineProperty(Application.prototype, "_fastHieararchyEnabled", {
  11538. get: function () {
  11539. _throwIfNotLoaded("_fastHieararchyEnabled", this.m__fastHieararchyEnabled, "Application", this._isNull);
  11540. return this.m__fastHieararchyEnabled;
  11541. },
  11542. enumerable: true,
  11543. configurable: true
  11544. });
  11545. Application.prototype.getActiveNotebook=function () {
  11546. return new OneNote.Notebook(this.context, _createMethodObjectPath(this.context, this, "GetActiveNotebook", OfficeExtension.OperationType.Read, [], false, false, null));
  11547. };
  11548. Application.prototype.getActiveNotebookOrNull=function () {
  11549. return new OneNote.Notebook(this.context, _createMethodObjectPath(this.context, this, "GetActiveNotebookOrNull", OfficeExtension.OperationType.Read, [], false, false, null));
  11550. };
  11551. Application.prototype.getActiveOutline=function () {
  11552. return new OneNote.Outline(this.context, _createMethodObjectPath(this.context, this, "GetActiveOutline", OfficeExtension.OperationType.Read, [], false, false, null));
  11553. };
  11554. Application.prototype.getActiveOutlineOrNull=function () {
  11555. return new OneNote.Outline(this.context, _createMethodObjectPath(this.context, this, "GetActiveOutlineOrNull", OfficeExtension.OperationType.Read, [], false, false, null));
  11556. };
  11557. Application.prototype.getActivePage=function () {
  11558. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "GetActivePage", OfficeExtension.OperationType.Read, [], false, false, null));
  11559. };
  11560. Application.prototype.getActivePageOrNull=function () {
  11561. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "GetActivePageOrNull", OfficeExtension.OperationType.Read, [], false, false, null));
  11562. };
  11563. Application.prototype.getActiveParagraph=function () {
  11564. return new OneNote.Paragraph(this.context, _createMethodObjectPath(this.context, this, "GetActiveParagraph", OfficeExtension.OperationType.Read, [], false, false, null));
  11565. };
  11566. Application.prototype.getActiveParagraphOrNull=function () {
  11567. return new OneNote.Paragraph(this.context, _createMethodObjectPath(this.context, this, "GetActiveParagraphOrNull", OfficeExtension.OperationType.Read, [], false, false, null));
  11568. };
  11569. Application.prototype.getActiveSection=function () {
  11570. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "GetActiveSection", OfficeExtension.OperationType.Read, [], false, false, null));
  11571. };
  11572. Application.prototype.getActiveSectionOrNull=function () {
  11573. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "GetActiveSectionOrNull", OfficeExtension.OperationType.Read, [], false, false, null));
  11574. };
  11575. Application.prototype.navigateToPage=function (page) {
  11576. _createMethodAction(this.context, this, "NavigateToPage", OfficeExtension.OperationType.Read, [page]);
  11577. };
  11578. Application.prototype.navigateToPageWithClientUrl=function (url) {
  11579. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "NavigateToPageWithClientUrl", OfficeExtension.OperationType.Read, [url], false, false, null));
  11580. };
  11581. Application.prototype._GetObjectByReferenceId=function (referenceId) {
  11582. var action=_createMethodAction(this.context, this, "_GetObjectByReferenceId", OfficeExtension.OperationType.Read, [referenceId]);
  11583. var ret=new OfficeExtension.ClientResult();
  11584. _addActionResultHandler(this, action, ret);
  11585. return ret;
  11586. };
  11587. Application.prototype._GetObjectTypeNameByReferenceId=function (referenceId) {
  11588. var action=_createMethodAction(this.context, this, "_GetObjectTypeNameByReferenceId", OfficeExtension.OperationType.Read, [referenceId]);
  11589. var ret=new OfficeExtension.ClientResult();
  11590. _addActionResultHandler(this, action, ret);
  11591. return ret;
  11592. };
  11593. Application.prototype._RemoveAllReferences=function () {
  11594. _createMethodAction(this.context, this, "_RemoveAllReferences", OfficeExtension.OperationType.Read, []);
  11595. };
  11596. Application.prototype._RemoveReference=function (referenceId) {
  11597. _createMethodAction(this.context, this, "_RemoveReference", OfficeExtension.OperationType.Read, [referenceId]);
  11598. };
  11599. Application.prototype._SendDataToLearningTools=function (data) {
  11600. var action=_createMethodAction(this.context, this, "_SendDataToLearningTools", OfficeExtension.OperationType.Default, [data]);
  11601. var ret=new OfficeExtension.ClientResult();
  11602. _addActionResultHandler(this, action, ret);
  11603. return ret;
  11604. };
  11605. Application.prototype._handleResult=function (value) {
  11606. _super.prototype._handleResult.call(this, value);
  11607. if (_isNullOrUndefined(value))
  11608. return;
  11609. var obj=value;
  11610. _fixObjectPathIfNecessary(this, obj);
  11611. if (!_isUndefined(obj["_fastHieararchyEnabled"])) {
  11612. this.m__fastHieararchyEnabled=obj["_fastHieararchyEnabled"];
  11613. }
  11614. _handleNavigationPropertyResults(this, obj, ["notebooks", "Notebooks"]);
  11615. };
  11616. Application.prototype.load=function (option) {
  11617. _load(this, option);
  11618. return this;
  11619. };
  11620. Application.prototype.toJSON=function () {
  11621. return {};
  11622. };
  11623. return Application;
  11624. }(OfficeExtension.ClientObject));
  11625. OneNote.Application=Application;
  11626. var InkAnalysis=(function (_super) {
  11627. __extends(InkAnalysis, _super);
  11628. function InkAnalysis() {
  11629. _super.apply(this, arguments);
  11630. }
  11631. Object.defineProperty(InkAnalysis.prototype, "page", {
  11632. get: function () {
  11633. if (!this.m_page) {
  11634. this.m_page=new OneNote.Page(this.context, _createPropertyObjectPath(this.context, this, "Page", false, false));
  11635. }
  11636. return this.m_page;
  11637. },
  11638. enumerable: true,
  11639. configurable: true
  11640. });
  11641. Object.defineProperty(InkAnalysis.prototype, "paragraphs", {
  11642. get: function () {
  11643. if (!this.m_paragraphs) {
  11644. this.m_paragraphs=new OneNote.InkAnalysisParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  11645. }
  11646. return this.m_paragraphs;
  11647. },
  11648. enumerable: true,
  11649. configurable: true
  11650. });
  11651. Object.defineProperty(InkAnalysis.prototype, "id", {
  11652. get: function () {
  11653. _throwIfNotLoaded("id", this.m_id, "InkAnalysis", this._isNull);
  11654. return this.m_id;
  11655. },
  11656. enumerable: true,
  11657. configurable: true
  11658. });
  11659. Object.defineProperty(InkAnalysis.prototype, "_ReferenceId", {
  11660. get: function () {
  11661. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysis", this._isNull);
  11662. return this.m__ReferenceId;
  11663. },
  11664. enumerable: true,
  11665. configurable: true
  11666. });
  11667. InkAnalysis.prototype._KeepReference=function () {
  11668. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11669. };
  11670. InkAnalysis.prototype._handleResult=function (value) {
  11671. _super.prototype._handleResult.call(this, value);
  11672. if (_isNullOrUndefined(value))
  11673. return;
  11674. var obj=value;
  11675. _fixObjectPathIfNecessary(this, obj);
  11676. if (!_isUndefined(obj["Id"])) {
  11677. this.m_id=obj["Id"];
  11678. }
  11679. if (!_isUndefined(obj["_ReferenceId"])) {
  11680. this.m__ReferenceId=obj["_ReferenceId"];
  11681. }
  11682. _handleNavigationPropertyResults(this, obj, ["page", "Page", "paragraphs", "Paragraphs"]);
  11683. };
  11684. InkAnalysis.prototype.load=function (option) {
  11685. _load(this, option);
  11686. return this;
  11687. };
  11688. InkAnalysis.prototype._handleIdResult=function (value) {
  11689. _super.prototype._handleIdResult.call(this, value);
  11690. if (_isNullOrUndefined(value)) {
  11691. return;
  11692. }
  11693. if (!_isUndefined(value["_ReferenceId"])) {
  11694. this.m__ReferenceId=value["_ReferenceId"];
  11695. }
  11696. if (!_isUndefined(value["Id"])) {
  11697. this.m_id=value["Id"];
  11698. }
  11699. };
  11700. InkAnalysis.prototype.track=function () {
  11701. this.context.trackedObjects.add(this);
  11702. return this;
  11703. };
  11704. InkAnalysis.prototype.untrack=function () {
  11705. this.context.trackedObjects.remove(this);
  11706. return this;
  11707. };
  11708. InkAnalysis.prototype.toJSON=function () {
  11709. return {
  11710. "id": this.m_id
  11711. };
  11712. };
  11713. return InkAnalysis;
  11714. }(OfficeExtension.ClientObject));
  11715. OneNote.InkAnalysis=InkAnalysis;
  11716. var InkAnalysisParagraph=(function (_super) {
  11717. __extends(InkAnalysisParagraph, _super);
  11718. function InkAnalysisParagraph() {
  11719. _super.apply(this, arguments);
  11720. }
  11721. Object.defineProperty(InkAnalysisParagraph.prototype, "inkAnalysis", {
  11722. get: function () {
  11723. if (!this.m_inkAnalysis) {
  11724. this.m_inkAnalysis=new OneNote.InkAnalysis(this.context, _createPropertyObjectPath(this.context, this, "InkAnalysis", false, false));
  11725. }
  11726. return this.m_inkAnalysis;
  11727. },
  11728. enumerable: true,
  11729. configurable: true
  11730. });
  11731. Object.defineProperty(InkAnalysisParagraph.prototype, "lines", {
  11732. get: function () {
  11733. if (!this.m_lines) {
  11734. this.m_lines=new OneNote.InkAnalysisLineCollection(this.context, _createPropertyObjectPath(this.context, this, "Lines", true, false));
  11735. }
  11736. return this.m_lines;
  11737. },
  11738. enumerable: true,
  11739. configurable: true
  11740. });
  11741. Object.defineProperty(InkAnalysisParagraph.prototype, "id", {
  11742. get: function () {
  11743. _throwIfNotLoaded("id", this.m_id, "InkAnalysisParagraph", this._isNull);
  11744. return this.m_id;
  11745. },
  11746. enumerable: true,
  11747. configurable: true
  11748. });
  11749. Object.defineProperty(InkAnalysisParagraph.prototype, "_ReferenceId", {
  11750. get: function () {
  11751. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisParagraph", this._isNull);
  11752. return this.m__ReferenceId;
  11753. },
  11754. enumerable: true,
  11755. configurable: true
  11756. });
  11757. InkAnalysisParagraph.prototype._KeepReference=function () {
  11758. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11759. };
  11760. InkAnalysisParagraph.prototype._handleResult=function (value) {
  11761. _super.prototype._handleResult.call(this, value);
  11762. if (_isNullOrUndefined(value))
  11763. return;
  11764. var obj=value;
  11765. _fixObjectPathIfNecessary(this, obj);
  11766. if (!_isUndefined(obj["Id"])) {
  11767. this.m_id=obj["Id"];
  11768. }
  11769. if (!_isUndefined(obj["_ReferenceId"])) {
  11770. this.m__ReferenceId=obj["_ReferenceId"];
  11771. }
  11772. _handleNavigationPropertyResults(this, obj, ["inkAnalysis", "InkAnalysis", "lines", "Lines"]);
  11773. };
  11774. InkAnalysisParagraph.prototype.load=function (option) {
  11775. _load(this, option);
  11776. return this;
  11777. };
  11778. InkAnalysisParagraph.prototype._handleIdResult=function (value) {
  11779. _super.prototype._handleIdResult.call(this, value);
  11780. if (_isNullOrUndefined(value)) {
  11781. return;
  11782. }
  11783. if (!_isUndefined(value["_ReferenceId"])) {
  11784. this.m__ReferenceId=value["_ReferenceId"];
  11785. }
  11786. if (!_isUndefined(value["Id"])) {
  11787. this.m_id=value["Id"];
  11788. }
  11789. };
  11790. InkAnalysisParagraph.prototype.track=function () {
  11791. this.context.trackedObjects.add(this);
  11792. return this;
  11793. };
  11794. InkAnalysisParagraph.prototype.untrack=function () {
  11795. this.context.trackedObjects.remove(this);
  11796. return this;
  11797. };
  11798. InkAnalysisParagraph.prototype.toJSON=function () {
  11799. return {
  11800. "id": this.m_id
  11801. };
  11802. };
  11803. return InkAnalysisParagraph;
  11804. }(OfficeExtension.ClientObject));
  11805. OneNote.InkAnalysisParagraph=InkAnalysisParagraph;
  11806. var InkAnalysisParagraphCollection=(function (_super) {
  11807. __extends(InkAnalysisParagraphCollection, _super);
  11808. function InkAnalysisParagraphCollection() {
  11809. _super.apply(this, arguments);
  11810. }
  11811. Object.defineProperty(InkAnalysisParagraphCollection.prototype, "items", {
  11812. get: function () {
  11813. _throwIfNotLoaded("items", this.m__items, "InkAnalysisParagraphCollection", this._isNull);
  11814. return this.m__items;
  11815. },
  11816. enumerable: true,
  11817. configurable: true
  11818. });
  11819. Object.defineProperty(InkAnalysisParagraphCollection.prototype, "count", {
  11820. get: function () {
  11821. _throwIfNotLoaded("count", this.m_count, "InkAnalysisParagraphCollection", this._isNull);
  11822. return this.m_count;
  11823. },
  11824. enumerable: true,
  11825. configurable: true
  11826. });
  11827. Object.defineProperty(InkAnalysisParagraphCollection.prototype, "_ReferenceId", {
  11828. get: function () {
  11829. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisParagraphCollection", this._isNull);
  11830. return this.m__ReferenceId;
  11831. },
  11832. enumerable: true,
  11833. configurable: true
  11834. });
  11835. InkAnalysisParagraphCollection.prototype.getItem=function (index) {
  11836. return new OneNote.InkAnalysisParagraph(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11837. };
  11838. InkAnalysisParagraphCollection.prototype.getItemAt=function (index) {
  11839. return new OneNote.InkAnalysisParagraph(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  11840. };
  11841. InkAnalysisParagraphCollection.prototype._KeepReference=function () {
  11842. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11843. };
  11844. InkAnalysisParagraphCollection.prototype._handleResult=function (value) {
  11845. _super.prototype._handleResult.call(this, value);
  11846. if (_isNullOrUndefined(value))
  11847. return;
  11848. var obj=value;
  11849. _fixObjectPathIfNecessary(this, obj);
  11850. if (!_isUndefined(obj["Count"])) {
  11851. this.m_count=obj["Count"];
  11852. }
  11853. if (!_isUndefined(obj["_ReferenceId"])) {
  11854. this.m__ReferenceId=obj["_ReferenceId"];
  11855. }
  11856. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11857. this.m__items=[];
  11858. var _data=obj[OfficeExtension.Constants.items];
  11859. for (var i=0; i < _data.length; i++) {
  11860. var _item=new OneNote.InkAnalysisParagraph(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11861. _item._handleResult(_data[i]);
  11862. this.m__items.push(_item);
  11863. }
  11864. }
  11865. };
  11866. InkAnalysisParagraphCollection.prototype.load=function (option) {
  11867. _load(this, option);
  11868. return this;
  11869. };
  11870. InkAnalysisParagraphCollection.prototype._handleIdResult=function (value) {
  11871. _super.prototype._handleIdResult.call(this, value);
  11872. if (_isNullOrUndefined(value)) {
  11873. return;
  11874. }
  11875. if (!_isUndefined(value["_ReferenceId"])) {
  11876. this.m__ReferenceId=value["_ReferenceId"];
  11877. }
  11878. };
  11879. InkAnalysisParagraphCollection.prototype.track=function () {
  11880. this.context.trackedObjects.add(this);
  11881. return this;
  11882. };
  11883. InkAnalysisParagraphCollection.prototype.untrack=function () {
  11884. this.context.trackedObjects.remove(this);
  11885. return this;
  11886. };
  11887. InkAnalysisParagraphCollection.prototype.toJSON=function () {
  11888. return {
  11889. "count": this.m_count
  11890. };
  11891. };
  11892. return InkAnalysisParagraphCollection;
  11893. }(OfficeExtension.ClientObject));
  11894. OneNote.InkAnalysisParagraphCollection=InkAnalysisParagraphCollection;
  11895. var InkAnalysisLine=(function (_super) {
  11896. __extends(InkAnalysisLine, _super);
  11897. function InkAnalysisLine() {
  11898. _super.apply(this, arguments);
  11899. }
  11900. Object.defineProperty(InkAnalysisLine.prototype, "paragraph", {
  11901. get: function () {
  11902. if (!this.m_paragraph) {
  11903. this.m_paragraph=new OneNote.InkAnalysisParagraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  11904. }
  11905. return this.m_paragraph;
  11906. },
  11907. enumerable: true,
  11908. configurable: true
  11909. });
  11910. Object.defineProperty(InkAnalysisLine.prototype, "words", {
  11911. get: function () {
  11912. if (!this.m_words) {
  11913. this.m_words=new OneNote.InkAnalysisWordCollection(this.context, _createPropertyObjectPath(this.context, this, "Words", true, false));
  11914. }
  11915. return this.m_words;
  11916. },
  11917. enumerable: true,
  11918. configurable: true
  11919. });
  11920. Object.defineProperty(InkAnalysisLine.prototype, "id", {
  11921. get: function () {
  11922. _throwIfNotLoaded("id", this.m_id, "InkAnalysisLine", this._isNull);
  11923. return this.m_id;
  11924. },
  11925. enumerable: true,
  11926. configurable: true
  11927. });
  11928. Object.defineProperty(InkAnalysisLine.prototype, "_ReferenceId", {
  11929. get: function () {
  11930. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisLine", this._isNull);
  11931. return this.m__ReferenceId;
  11932. },
  11933. enumerable: true,
  11934. configurable: true
  11935. });
  11936. InkAnalysisLine.prototype._KeepReference=function () {
  11937. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11938. };
  11939. InkAnalysisLine.prototype._handleResult=function (value) {
  11940. _super.prototype._handleResult.call(this, value);
  11941. if (_isNullOrUndefined(value))
  11942. return;
  11943. var obj=value;
  11944. _fixObjectPathIfNecessary(this, obj);
  11945. if (!_isUndefined(obj["Id"])) {
  11946. this.m_id=obj["Id"];
  11947. }
  11948. if (!_isUndefined(obj["_ReferenceId"])) {
  11949. this.m__ReferenceId=obj["_ReferenceId"];
  11950. }
  11951. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph", "words", "Words"]);
  11952. };
  11953. InkAnalysisLine.prototype.load=function (option) {
  11954. _load(this, option);
  11955. return this;
  11956. };
  11957. InkAnalysisLine.prototype._handleIdResult=function (value) {
  11958. _super.prototype._handleIdResult.call(this, value);
  11959. if (_isNullOrUndefined(value)) {
  11960. return;
  11961. }
  11962. if (!_isUndefined(value["_ReferenceId"])) {
  11963. this.m__ReferenceId=value["_ReferenceId"];
  11964. }
  11965. if (!_isUndefined(value["Id"])) {
  11966. this.m_id=value["Id"];
  11967. }
  11968. };
  11969. InkAnalysisLine.prototype.track=function () {
  11970. this.context.trackedObjects.add(this);
  11971. return this;
  11972. };
  11973. InkAnalysisLine.prototype.untrack=function () {
  11974. this.context.trackedObjects.remove(this);
  11975. return this;
  11976. };
  11977. InkAnalysisLine.prototype.toJSON=function () {
  11978. return {
  11979. "id": this.m_id
  11980. };
  11981. };
  11982. return InkAnalysisLine;
  11983. }(OfficeExtension.ClientObject));
  11984. OneNote.InkAnalysisLine=InkAnalysisLine;
  11985. var InkAnalysisLineCollection=(function (_super) {
  11986. __extends(InkAnalysisLineCollection, _super);
  11987. function InkAnalysisLineCollection() {
  11988. _super.apply(this, arguments);
  11989. }
  11990. Object.defineProperty(InkAnalysisLineCollection.prototype, "items", {
  11991. get: function () {
  11992. _throwIfNotLoaded("items", this.m__items, "InkAnalysisLineCollection", this._isNull);
  11993. return this.m__items;
  11994. },
  11995. enumerable: true,
  11996. configurable: true
  11997. });
  11998. Object.defineProperty(InkAnalysisLineCollection.prototype, "count", {
  11999. get: function () {
  12000. _throwIfNotLoaded("count", this.m_count, "InkAnalysisLineCollection", this._isNull);
  12001. return this.m_count;
  12002. },
  12003. enumerable: true,
  12004. configurable: true
  12005. });
  12006. Object.defineProperty(InkAnalysisLineCollection.prototype, "_ReferenceId", {
  12007. get: function () {
  12008. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisLineCollection", this._isNull);
  12009. return this.m__ReferenceId;
  12010. },
  12011. enumerable: true,
  12012. configurable: true
  12013. });
  12014. InkAnalysisLineCollection.prototype.getItem=function (index) {
  12015. return new OneNote.InkAnalysisLine(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12016. };
  12017. InkAnalysisLineCollection.prototype.getItemAt=function (index) {
  12018. return new OneNote.InkAnalysisLine(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  12019. };
  12020. InkAnalysisLineCollection.prototype._KeepReference=function () {
  12021. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12022. };
  12023. InkAnalysisLineCollection.prototype._handleResult=function (value) {
  12024. _super.prototype._handleResult.call(this, value);
  12025. if (_isNullOrUndefined(value))
  12026. return;
  12027. var obj=value;
  12028. _fixObjectPathIfNecessary(this, obj);
  12029. if (!_isUndefined(obj["Count"])) {
  12030. this.m_count=obj["Count"];
  12031. }
  12032. if (!_isUndefined(obj["_ReferenceId"])) {
  12033. this.m__ReferenceId=obj["_ReferenceId"];
  12034. }
  12035. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12036. this.m__items=[];
  12037. var _data=obj[OfficeExtension.Constants.items];
  12038. for (var i=0; i < _data.length; i++) {
  12039. var _item=new OneNote.InkAnalysisLine(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12040. _item._handleResult(_data[i]);
  12041. this.m__items.push(_item);
  12042. }
  12043. }
  12044. };
  12045. InkAnalysisLineCollection.prototype.load=function (option) {
  12046. _load(this, option);
  12047. return this;
  12048. };
  12049. InkAnalysisLineCollection.prototype._handleIdResult=function (value) {
  12050. _super.prototype._handleIdResult.call(this, value);
  12051. if (_isNullOrUndefined(value)) {
  12052. return;
  12053. }
  12054. if (!_isUndefined(value["_ReferenceId"])) {
  12055. this.m__ReferenceId=value["_ReferenceId"];
  12056. }
  12057. };
  12058. InkAnalysisLineCollection.prototype.track=function () {
  12059. this.context.trackedObjects.add(this);
  12060. return this;
  12061. };
  12062. InkAnalysisLineCollection.prototype.untrack=function () {
  12063. this.context.trackedObjects.remove(this);
  12064. return this;
  12065. };
  12066. InkAnalysisLineCollection.prototype.toJSON=function () {
  12067. return {
  12068. "count": this.m_count
  12069. };
  12070. };
  12071. return InkAnalysisLineCollection;
  12072. }(OfficeExtension.ClientObject));
  12073. OneNote.InkAnalysisLineCollection=InkAnalysisLineCollection;
  12074. var InkAnalysisWord=(function (_super) {
  12075. __extends(InkAnalysisWord, _super);
  12076. function InkAnalysisWord() {
  12077. _super.apply(this, arguments);
  12078. }
  12079. Object.defineProperty(InkAnalysisWord.prototype, "line", {
  12080. get: function () {
  12081. if (!this.m_line) {
  12082. this.m_line=new OneNote.InkAnalysisLine(this.context, _createPropertyObjectPath(this.context, this, "Line", false, false));
  12083. }
  12084. return this.m_line;
  12085. },
  12086. enumerable: true,
  12087. configurable: true
  12088. });
  12089. Object.defineProperty(InkAnalysisWord.prototype, "id", {
  12090. get: function () {
  12091. _throwIfNotLoaded("id", this.m_id, "InkAnalysisWord", this._isNull);
  12092. return this.m_id;
  12093. },
  12094. enumerable: true,
  12095. configurable: true
  12096. });
  12097. Object.defineProperty(InkAnalysisWord.prototype, "languageId", {
  12098. get: function () {
  12099. _throwIfNotLoaded("languageId", this.m_languageId, "InkAnalysisWord", this._isNull);
  12100. return this.m_languageId;
  12101. },
  12102. enumerable: true,
  12103. configurable: true
  12104. });
  12105. Object.defineProperty(InkAnalysisWord.prototype, "strokePointers", {
  12106. get: function () {
  12107. _throwIfNotLoaded("strokePointers", this.m_strokePointers, "InkAnalysisWord", this._isNull);
  12108. return this.m_strokePointers;
  12109. },
  12110. enumerable: true,
  12111. configurable: true
  12112. });
  12113. Object.defineProperty(InkAnalysisWord.prototype, "wordAlternates", {
  12114. get: function () {
  12115. _throwIfNotLoaded("wordAlternates", this.m_wordAlternates, "InkAnalysisWord", this._isNull);
  12116. return this.m_wordAlternates;
  12117. },
  12118. enumerable: true,
  12119. configurable: true
  12120. });
  12121. Object.defineProperty(InkAnalysisWord.prototype, "_ReferenceId", {
  12122. get: function () {
  12123. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisWord", this._isNull);
  12124. return this.m__ReferenceId;
  12125. },
  12126. enumerable: true,
  12127. configurable: true
  12128. });
  12129. InkAnalysisWord.prototype._KeepReference=function () {
  12130. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12131. };
  12132. InkAnalysisWord.prototype._handleResult=function (value) {
  12133. _super.prototype._handleResult.call(this, value);
  12134. if (_isNullOrUndefined(value))
  12135. return;
  12136. var obj=value;
  12137. _fixObjectPathIfNecessary(this, obj);
  12138. if (!_isUndefined(obj["Id"])) {
  12139. this.m_id=obj["Id"];
  12140. }
  12141. if (!_isUndefined(obj["LanguageId"])) {
  12142. this.m_languageId=obj["LanguageId"];
  12143. }
  12144. if (!_isUndefined(obj["StrokePointers"])) {
  12145. this.m_strokePointers=obj["StrokePointers"];
  12146. }
  12147. if (!_isUndefined(obj["WordAlternates"])) {
  12148. this.m_wordAlternates=obj["WordAlternates"];
  12149. }
  12150. if (!_isUndefined(obj["_ReferenceId"])) {
  12151. this.m__ReferenceId=obj["_ReferenceId"];
  12152. }
  12153. _handleNavigationPropertyResults(this, obj, ["line", "Line"]);
  12154. };
  12155. InkAnalysisWord.prototype.load=function (option) {
  12156. _load(this, option);
  12157. return this;
  12158. };
  12159. InkAnalysisWord.prototype._handleIdResult=function (value) {
  12160. _super.prototype._handleIdResult.call(this, value);
  12161. if (_isNullOrUndefined(value)) {
  12162. return;
  12163. }
  12164. if (!_isUndefined(value["_ReferenceId"])) {
  12165. this.m__ReferenceId=value["_ReferenceId"];
  12166. }
  12167. if (!_isUndefined(value["Id"])) {
  12168. this.m_id=value["Id"];
  12169. }
  12170. };
  12171. InkAnalysisWord.prototype.track=function () {
  12172. this.context.trackedObjects.add(this);
  12173. return this;
  12174. };
  12175. InkAnalysisWord.prototype.untrack=function () {
  12176. this.context.trackedObjects.remove(this);
  12177. return this;
  12178. };
  12179. InkAnalysisWord.prototype.toJSON=function () {
  12180. return {
  12181. "id": this.m_id,
  12182. "languageId": this.m_languageId,
  12183. "strokePointers": this.m_strokePointers,
  12184. "wordAlternates": this.m_wordAlternates
  12185. };
  12186. };
  12187. return InkAnalysisWord;
  12188. }(OfficeExtension.ClientObject));
  12189. OneNote.InkAnalysisWord=InkAnalysisWord;
  12190. var InkAnalysisWordCollection=(function (_super) {
  12191. __extends(InkAnalysisWordCollection, _super);
  12192. function InkAnalysisWordCollection() {
  12193. _super.apply(this, arguments);
  12194. }
  12195. Object.defineProperty(InkAnalysisWordCollection.prototype, "items", {
  12196. get: function () {
  12197. _throwIfNotLoaded("items", this.m__items, "InkAnalysisWordCollection", this._isNull);
  12198. return this.m__items;
  12199. },
  12200. enumerable: true,
  12201. configurable: true
  12202. });
  12203. Object.defineProperty(InkAnalysisWordCollection.prototype, "count", {
  12204. get: function () {
  12205. _throwIfNotLoaded("count", this.m_count, "InkAnalysisWordCollection", this._isNull);
  12206. return this.m_count;
  12207. },
  12208. enumerable: true,
  12209. configurable: true
  12210. });
  12211. Object.defineProperty(InkAnalysisWordCollection.prototype, "_ReferenceId", {
  12212. get: function () {
  12213. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisWordCollection", this._isNull);
  12214. return this.m__ReferenceId;
  12215. },
  12216. enumerable: true,
  12217. configurable: true
  12218. });
  12219. InkAnalysisWordCollection.prototype.getItem=function (index) {
  12220. return new OneNote.InkAnalysisWord(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12221. };
  12222. InkAnalysisWordCollection.prototype.getItemAt=function (index) {
  12223. return new OneNote.InkAnalysisWord(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  12224. };
  12225. InkAnalysisWordCollection.prototype._KeepReference=function () {
  12226. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12227. };
  12228. InkAnalysisWordCollection.prototype._handleResult=function (value) {
  12229. _super.prototype._handleResult.call(this, value);
  12230. if (_isNullOrUndefined(value))
  12231. return;
  12232. var obj=value;
  12233. _fixObjectPathIfNecessary(this, obj);
  12234. if (!_isUndefined(obj["Count"])) {
  12235. this.m_count=obj["Count"];
  12236. }
  12237. if (!_isUndefined(obj["_ReferenceId"])) {
  12238. this.m__ReferenceId=obj["_ReferenceId"];
  12239. }
  12240. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12241. this.m__items=[];
  12242. var _data=obj[OfficeExtension.Constants.items];
  12243. for (var i=0; i < _data.length; i++) {
  12244. var _item=new OneNote.InkAnalysisWord(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12245. _item._handleResult(_data[i]);
  12246. this.m__items.push(_item);
  12247. }
  12248. }
  12249. };
  12250. InkAnalysisWordCollection.prototype.load=function (option) {
  12251. _load(this, option);
  12252. return this;
  12253. };
  12254. InkAnalysisWordCollection.prototype._handleIdResult=function (value) {
  12255. _super.prototype._handleIdResult.call(this, value);
  12256. if (_isNullOrUndefined(value)) {
  12257. return;
  12258. }
  12259. if (!_isUndefined(value["_ReferenceId"])) {
  12260. this.m__ReferenceId=value["_ReferenceId"];
  12261. }
  12262. };
  12263. InkAnalysisWordCollection.prototype.track=function () {
  12264. this.context.trackedObjects.add(this);
  12265. return this;
  12266. };
  12267. InkAnalysisWordCollection.prototype.untrack=function () {
  12268. this.context.trackedObjects.remove(this);
  12269. return this;
  12270. };
  12271. InkAnalysisWordCollection.prototype.toJSON=function () {
  12272. return {
  12273. "count": this.m_count
  12274. };
  12275. };
  12276. return InkAnalysisWordCollection;
  12277. }(OfficeExtension.ClientObject));
  12278. OneNote.InkAnalysisWordCollection=InkAnalysisWordCollection;
  12279. var FloatingInk=(function (_super) {
  12280. __extends(FloatingInk, _super);
  12281. function FloatingInk() {
  12282. _super.apply(this, arguments);
  12283. }
  12284. Object.defineProperty(FloatingInk.prototype, "inkStrokes", {
  12285. get: function () {
  12286. if (!this.m_inkStrokes) {
  12287. this.m_inkStrokes=new OneNote.InkStrokeCollection(this.context, _createPropertyObjectPath(this.context, this, "InkStrokes", true, false));
  12288. }
  12289. return this.m_inkStrokes;
  12290. },
  12291. enumerable: true,
  12292. configurable: true
  12293. });
  12294. Object.defineProperty(FloatingInk.prototype, "pageContent", {
  12295. get: function () {
  12296. if (!this.m_pageContent) {
  12297. this.m_pageContent=new OneNote.PageContent(this.context, _createPropertyObjectPath(this.context, this, "PageContent", false, false));
  12298. }
  12299. return this.m_pageContent;
  12300. },
  12301. enumerable: true,
  12302. configurable: true
  12303. });
  12304. Object.defineProperty(FloatingInk.prototype, "id", {
  12305. get: function () {
  12306. _throwIfNotLoaded("id", this.m_id, "FloatingInk", this._isNull);
  12307. return this.m_id;
  12308. },
  12309. enumerable: true,
  12310. configurable: true
  12311. });
  12312. Object.defineProperty(FloatingInk.prototype, "_ReferenceId", {
  12313. get: function () {
  12314. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "FloatingInk", this._isNull);
  12315. return this.m__ReferenceId;
  12316. },
  12317. enumerable: true,
  12318. configurable: true
  12319. });
  12320. FloatingInk.prototype._KeepReference=function () {
  12321. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12322. };
  12323. FloatingInk.prototype._handleResult=function (value) {
  12324. _super.prototype._handleResult.call(this, value);
  12325. if (_isNullOrUndefined(value))
  12326. return;
  12327. var obj=value;
  12328. _fixObjectPathIfNecessary(this, obj);
  12329. if (!_isUndefined(obj["Id"])) {
  12330. this.m_id=obj["Id"];
  12331. }
  12332. if (!_isUndefined(obj["_ReferenceId"])) {
  12333. this.m__ReferenceId=obj["_ReferenceId"];
  12334. }
  12335. _handleNavigationPropertyResults(this, obj, ["inkStrokes", "InkStrokes", "pageContent", "PageContent"]);
  12336. };
  12337. FloatingInk.prototype.load=function (option) {
  12338. _load(this, option);
  12339. return this;
  12340. };
  12341. FloatingInk.prototype._handleIdResult=function (value) {
  12342. _super.prototype._handleIdResult.call(this, value);
  12343. if (_isNullOrUndefined(value)) {
  12344. return;
  12345. }
  12346. if (!_isUndefined(value["_ReferenceId"])) {
  12347. this.m__ReferenceId=value["_ReferenceId"];
  12348. }
  12349. if (!_isUndefined(value["Id"])) {
  12350. this.m_id=value["Id"];
  12351. }
  12352. };
  12353. FloatingInk.prototype.track=function () {
  12354. this.context.trackedObjects.add(this);
  12355. return this;
  12356. };
  12357. FloatingInk.prototype.untrack=function () {
  12358. this.context.trackedObjects.remove(this);
  12359. return this;
  12360. };
  12361. FloatingInk.prototype.toJSON=function () {
  12362. return {
  12363. "id": this.m_id
  12364. };
  12365. };
  12366. return FloatingInk;
  12367. }(OfficeExtension.ClientObject));
  12368. OneNote.FloatingInk=FloatingInk;
  12369. var InkStroke=(function (_super) {
  12370. __extends(InkStroke, _super);
  12371. function InkStroke() {
  12372. _super.apply(this, arguments);
  12373. }
  12374. Object.defineProperty(InkStroke.prototype, "floatingInk", {
  12375. get: function () {
  12376. if (!this.m_floatingInk) {
  12377. this.m_floatingInk=new OneNote.FloatingInk(this.context, _createPropertyObjectPath(this.context, this, "FloatingInk", false, false));
  12378. }
  12379. return this.m_floatingInk;
  12380. },
  12381. enumerable: true,
  12382. configurable: true
  12383. });
  12384. Object.defineProperty(InkStroke.prototype, "id", {
  12385. get: function () {
  12386. _throwIfNotLoaded("id", this.m_id, "InkStroke", this._isNull);
  12387. return this.m_id;
  12388. },
  12389. enumerable: true,
  12390. configurable: true
  12391. });
  12392. Object.defineProperty(InkStroke.prototype, "_ReferenceId", {
  12393. get: function () {
  12394. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkStroke", this._isNull);
  12395. return this.m__ReferenceId;
  12396. },
  12397. enumerable: true,
  12398. configurable: true
  12399. });
  12400. InkStroke.prototype._KeepReference=function () {
  12401. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12402. };
  12403. InkStroke.prototype._handleResult=function (value) {
  12404. _super.prototype._handleResult.call(this, value);
  12405. if (_isNullOrUndefined(value))
  12406. return;
  12407. var obj=value;
  12408. _fixObjectPathIfNecessary(this, obj);
  12409. if (!_isUndefined(obj["Id"])) {
  12410. this.m_id=obj["Id"];
  12411. }
  12412. if (!_isUndefined(obj["_ReferenceId"])) {
  12413. this.m__ReferenceId=obj["_ReferenceId"];
  12414. }
  12415. _handleNavigationPropertyResults(this, obj, ["floatingInk", "FloatingInk"]);
  12416. };
  12417. InkStroke.prototype.load=function (option) {
  12418. _load(this, option);
  12419. return this;
  12420. };
  12421. InkStroke.prototype._handleIdResult=function (value) {
  12422. _super.prototype._handleIdResult.call(this, value);
  12423. if (_isNullOrUndefined(value)) {
  12424. return;
  12425. }
  12426. if (!_isUndefined(value["_ReferenceId"])) {
  12427. this.m__ReferenceId=value["_ReferenceId"];
  12428. }
  12429. if (!_isUndefined(value["Id"])) {
  12430. this.m_id=value["Id"];
  12431. }
  12432. };
  12433. InkStroke.prototype.track=function () {
  12434. this.context.trackedObjects.add(this);
  12435. return this;
  12436. };
  12437. InkStroke.prototype.untrack=function () {
  12438. this.context.trackedObjects.remove(this);
  12439. return this;
  12440. };
  12441. InkStroke.prototype.toJSON=function () {
  12442. return {
  12443. "id": this.m_id
  12444. };
  12445. };
  12446. return InkStroke;
  12447. }(OfficeExtension.ClientObject));
  12448. OneNote.InkStroke=InkStroke;
  12449. var InkStrokeCollection=(function (_super) {
  12450. __extends(InkStrokeCollection, _super);
  12451. function InkStrokeCollection() {
  12452. _super.apply(this, arguments);
  12453. }
  12454. Object.defineProperty(InkStrokeCollection.prototype, "items", {
  12455. get: function () {
  12456. _throwIfNotLoaded("items", this.m__items, "InkStrokeCollection", this._isNull);
  12457. return this.m__items;
  12458. },
  12459. enumerable: true,
  12460. configurable: true
  12461. });
  12462. Object.defineProperty(InkStrokeCollection.prototype, "count", {
  12463. get: function () {
  12464. _throwIfNotLoaded("count", this.m_count, "InkStrokeCollection", this._isNull);
  12465. return this.m_count;
  12466. },
  12467. enumerable: true,
  12468. configurable: true
  12469. });
  12470. Object.defineProperty(InkStrokeCollection.prototype, "_ReferenceId", {
  12471. get: function () {
  12472. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkStrokeCollection", this._isNull);
  12473. return this.m__ReferenceId;
  12474. },
  12475. enumerable: true,
  12476. configurable: true
  12477. });
  12478. InkStrokeCollection.prototype.getItem=function (index) {
  12479. return new OneNote.InkStroke(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12480. };
  12481. InkStrokeCollection.prototype.getItemAt=function (index) {
  12482. return new OneNote.InkStroke(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  12483. };
  12484. InkStrokeCollection.prototype._KeepReference=function () {
  12485. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12486. };
  12487. InkStrokeCollection.prototype._handleResult=function (value) {
  12488. _super.prototype._handleResult.call(this, value);
  12489. if (_isNullOrUndefined(value))
  12490. return;
  12491. var obj=value;
  12492. _fixObjectPathIfNecessary(this, obj);
  12493. if (!_isUndefined(obj["Count"])) {
  12494. this.m_count=obj["Count"];
  12495. }
  12496. if (!_isUndefined(obj["_ReferenceId"])) {
  12497. this.m__ReferenceId=obj["_ReferenceId"];
  12498. }
  12499. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12500. this.m__items=[];
  12501. var _data=obj[OfficeExtension.Constants.items];
  12502. for (var i=0; i < _data.length; i++) {
  12503. var _item=new OneNote.InkStroke(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12504. _item._handleResult(_data[i]);
  12505. this.m__items.push(_item);
  12506. }
  12507. }
  12508. };
  12509. InkStrokeCollection.prototype.load=function (option) {
  12510. _load(this, option);
  12511. return this;
  12512. };
  12513. InkStrokeCollection.prototype._handleIdResult=function (value) {
  12514. _super.prototype._handleIdResult.call(this, value);
  12515. if (_isNullOrUndefined(value)) {
  12516. return;
  12517. }
  12518. if (!_isUndefined(value["_ReferenceId"])) {
  12519. this.m__ReferenceId=value["_ReferenceId"];
  12520. }
  12521. };
  12522. InkStrokeCollection.prototype.track=function () {
  12523. this.context.trackedObjects.add(this);
  12524. return this;
  12525. };
  12526. InkStrokeCollection.prototype.untrack=function () {
  12527. this.context.trackedObjects.remove(this);
  12528. return this;
  12529. };
  12530. InkStrokeCollection.prototype.toJSON=function () {
  12531. return {
  12532. "count": this.m_count
  12533. };
  12534. };
  12535. return InkStrokeCollection;
  12536. }(OfficeExtension.ClientObject));
  12537. OneNote.InkStrokeCollection=InkStrokeCollection;
  12538. var InkWord=(function (_super) {
  12539. __extends(InkWord, _super);
  12540. function InkWord() {
  12541. _super.apply(this, arguments);
  12542. }
  12543. Object.defineProperty(InkWord.prototype, "paragraph", {
  12544. get: function () {
  12545. if (!this.m_paragraph) {
  12546. this.m_paragraph=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  12547. }
  12548. return this.m_paragraph;
  12549. },
  12550. enumerable: true,
  12551. configurable: true
  12552. });
  12553. Object.defineProperty(InkWord.prototype, "id", {
  12554. get: function () {
  12555. _throwIfNotLoaded("id", this.m_id, "InkWord", this._isNull);
  12556. return this.m_id;
  12557. },
  12558. enumerable: true,
  12559. configurable: true
  12560. });
  12561. Object.defineProperty(InkWord.prototype, "languageId", {
  12562. get: function () {
  12563. _throwIfNotLoaded("languageId", this.m_languageId, "InkWord", this._isNull);
  12564. return this.m_languageId;
  12565. },
  12566. enumerable: true,
  12567. configurable: true
  12568. });
  12569. Object.defineProperty(InkWord.prototype, "wordAlternates", {
  12570. get: function () {
  12571. _throwIfNotLoaded("wordAlternates", this.m_wordAlternates, "InkWord", this._isNull);
  12572. return this.m_wordAlternates;
  12573. },
  12574. enumerable: true,
  12575. configurable: true
  12576. });
  12577. Object.defineProperty(InkWord.prototype, "_ReferenceId", {
  12578. get: function () {
  12579. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkWord", this._isNull);
  12580. return this.m__ReferenceId;
  12581. },
  12582. enumerable: true,
  12583. configurable: true
  12584. });
  12585. InkWord.prototype._KeepReference=function () {
  12586. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12587. };
  12588. InkWord.prototype._handleResult=function (value) {
  12589. _super.prototype._handleResult.call(this, value);
  12590. if (_isNullOrUndefined(value))
  12591. return;
  12592. var obj=value;
  12593. _fixObjectPathIfNecessary(this, obj);
  12594. if (!_isUndefined(obj["Id"])) {
  12595. this.m_id=obj["Id"];
  12596. }
  12597. if (!_isUndefined(obj["LanguageId"])) {
  12598. this.m_languageId=obj["LanguageId"];
  12599. }
  12600. if (!_isUndefined(obj["WordAlternates"])) {
  12601. this.m_wordAlternates=obj["WordAlternates"];
  12602. }
  12603. if (!_isUndefined(obj["_ReferenceId"])) {
  12604. this.m__ReferenceId=obj["_ReferenceId"];
  12605. }
  12606. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph"]);
  12607. };
  12608. InkWord.prototype.load=function (option) {
  12609. _load(this, option);
  12610. return this;
  12611. };
  12612. InkWord.prototype._handleIdResult=function (value) {
  12613. _super.prototype._handleIdResult.call(this, value);
  12614. if (_isNullOrUndefined(value)) {
  12615. return;
  12616. }
  12617. if (!_isUndefined(value["_ReferenceId"])) {
  12618. this.m__ReferenceId=value["_ReferenceId"];
  12619. }
  12620. if (!_isUndefined(value["Id"])) {
  12621. this.m_id=value["Id"];
  12622. }
  12623. };
  12624. InkWord.prototype.track=function () {
  12625. this.context.trackedObjects.add(this);
  12626. return this;
  12627. };
  12628. InkWord.prototype.untrack=function () {
  12629. this.context.trackedObjects.remove(this);
  12630. return this;
  12631. };
  12632. InkWord.prototype.toJSON=function () {
  12633. return {
  12634. "id": this.m_id,
  12635. "languageId": this.m_languageId,
  12636. "wordAlternates": this.m_wordAlternates
  12637. };
  12638. };
  12639. return InkWord;
  12640. }(OfficeExtension.ClientObject));
  12641. OneNote.InkWord=InkWord;
  12642. var InkWordCollection=(function (_super) {
  12643. __extends(InkWordCollection, _super);
  12644. function InkWordCollection() {
  12645. _super.apply(this, arguments);
  12646. }
  12647. Object.defineProperty(InkWordCollection.prototype, "items", {
  12648. get: function () {
  12649. _throwIfNotLoaded("items", this.m__items, "InkWordCollection", this._isNull);
  12650. return this.m__items;
  12651. },
  12652. enumerable: true,
  12653. configurable: true
  12654. });
  12655. Object.defineProperty(InkWordCollection.prototype, "count", {
  12656. get: function () {
  12657. _throwIfNotLoaded("count", this.m_count, "InkWordCollection", this._isNull);
  12658. return this.m_count;
  12659. },
  12660. enumerable: true,
  12661. configurable: true
  12662. });
  12663. Object.defineProperty(InkWordCollection.prototype, "_ReferenceId", {
  12664. get: function () {
  12665. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkWordCollection", this._isNull);
  12666. return this.m__ReferenceId;
  12667. },
  12668. enumerable: true,
  12669. configurable: true
  12670. });
  12671. InkWordCollection.prototype.getItem=function (index) {
  12672. return new OneNote.InkWord(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12673. };
  12674. InkWordCollection.prototype.getItemAt=function (index) {
  12675. return new OneNote.InkWord(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  12676. };
  12677. InkWordCollection.prototype._KeepReference=function () {
  12678. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12679. };
  12680. InkWordCollection.prototype._handleResult=function (value) {
  12681. _super.prototype._handleResult.call(this, value);
  12682. if (_isNullOrUndefined(value))
  12683. return;
  12684. var obj=value;
  12685. _fixObjectPathIfNecessary(this, obj);
  12686. if (!_isUndefined(obj["Count"])) {
  12687. this.m_count=obj["Count"];
  12688. }
  12689. if (!_isUndefined(obj["_ReferenceId"])) {
  12690. this.m__ReferenceId=obj["_ReferenceId"];
  12691. }
  12692. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12693. this.m__items=[];
  12694. var _data=obj[OfficeExtension.Constants.items];
  12695. for (var i=0; i < _data.length; i++) {
  12696. var _item=new OneNote.InkWord(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12697. _item._handleResult(_data[i]);
  12698. this.m__items.push(_item);
  12699. }
  12700. }
  12701. };
  12702. InkWordCollection.prototype.load=function (option) {
  12703. _load(this, option);
  12704. return this;
  12705. };
  12706. InkWordCollection.prototype._handleIdResult=function (value) {
  12707. _super.prototype._handleIdResult.call(this, value);
  12708. if (_isNullOrUndefined(value)) {
  12709. return;
  12710. }
  12711. if (!_isUndefined(value["_ReferenceId"])) {
  12712. this.m__ReferenceId=value["_ReferenceId"];
  12713. }
  12714. };
  12715. InkWordCollection.prototype.track=function () {
  12716. this.context.trackedObjects.add(this);
  12717. return this;
  12718. };
  12719. InkWordCollection.prototype.untrack=function () {
  12720. this.context.trackedObjects.remove(this);
  12721. return this;
  12722. };
  12723. InkWordCollection.prototype.toJSON=function () {
  12724. return {
  12725. "count": this.m_count
  12726. };
  12727. };
  12728. return InkWordCollection;
  12729. }(OfficeExtension.ClientObject));
  12730. OneNote.InkWordCollection=InkWordCollection;
  12731. var Notebook=(function (_super) {
  12732. __extends(Notebook, _super);
  12733. function Notebook() {
  12734. _super.apply(this, arguments);
  12735. }
  12736. Object.defineProperty(Notebook.prototype, "sectionGroups", {
  12737. get: function () {
  12738. if (!this.m_sectionGroups) {
  12739. this.m_sectionGroups=new OneNote.SectionGroupCollection(this.context, _createPropertyObjectPath(this.context, this, "SectionGroups", true, false));
  12740. }
  12741. return this.m_sectionGroups;
  12742. },
  12743. enumerable: true,
  12744. configurable: true
  12745. });
  12746. Object.defineProperty(Notebook.prototype, "sections", {
  12747. get: function () {
  12748. if (!this.m_sections) {
  12749. this.m_sections=new OneNote.SectionCollection(this.context, _createPropertyObjectPath(this.context, this, "Sections", true, false));
  12750. }
  12751. return this.m_sections;
  12752. },
  12753. enumerable: true,
  12754. configurable: true
  12755. });
  12756. Object.defineProperty(Notebook.prototype, "clientUrl", {
  12757. get: function () {
  12758. _throwIfNotLoaded("clientUrl", this.m_clientUrl, "Notebook", this._isNull);
  12759. return this.m_clientUrl;
  12760. },
  12761. enumerable: true,
  12762. configurable: true
  12763. });
  12764. Object.defineProperty(Notebook.prototype, "id", {
  12765. get: function () {
  12766. _throwIfNotLoaded("id", this.m_id, "Notebook", this._isNull);
  12767. return this.m_id;
  12768. },
  12769. enumerable: true,
  12770. configurable: true
  12771. });
  12772. Object.defineProperty(Notebook.prototype, "name", {
  12773. get: function () {
  12774. _throwIfNotLoaded("name", this.m_name, "Notebook", this._isNull);
  12775. return this.m_name;
  12776. },
  12777. enumerable: true,
  12778. configurable: true
  12779. });
  12780. Object.defineProperty(Notebook.prototype, "_ReferenceId", {
  12781. get: function () {
  12782. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Notebook", this._isNull);
  12783. return this.m__ReferenceId;
  12784. },
  12785. enumerable: true,
  12786. configurable: true
  12787. });
  12788. Notebook.prototype.addSection=function (name) {
  12789. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "AddSection", OfficeExtension.OperationType.Default, [name], false, true, null));
  12790. };
  12791. Notebook.prototype.addSectionGroup=function (name) {
  12792. return new OneNote.SectionGroup(this.context, _createMethodObjectPath(this.context, this, "AddSectionGroup", OfficeExtension.OperationType.Default, [name], false, true, null));
  12793. };
  12794. Notebook.prototype._KeepReference=function () {
  12795. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12796. };
  12797. Notebook.prototype._Sync=function () {
  12798. _createMethodAction(this.context, this, "_Sync", OfficeExtension.OperationType.Default, []);
  12799. };
  12800. Notebook.prototype._handleResult=function (value) {
  12801. _super.prototype._handleResult.call(this, value);
  12802. if (_isNullOrUndefined(value))
  12803. return;
  12804. var obj=value;
  12805. _fixObjectPathIfNecessary(this, obj);
  12806. if (!_isUndefined(obj["ClientUrl"])) {
  12807. this.m_clientUrl=obj["ClientUrl"];
  12808. }
  12809. if (!_isUndefined(obj["Id"])) {
  12810. this.m_id=obj["Id"];
  12811. }
  12812. if (!_isUndefined(obj["Name"])) {
  12813. this.m_name=obj["Name"];
  12814. }
  12815. if (!_isUndefined(obj["_ReferenceId"])) {
  12816. this.m__ReferenceId=obj["_ReferenceId"];
  12817. }
  12818. _handleNavigationPropertyResults(this, obj, ["sectionGroups", "SectionGroups", "sections", "Sections"]);
  12819. };
  12820. Notebook.prototype.load=function (option) {
  12821. _load(this, option);
  12822. return this;
  12823. };
  12824. Notebook.prototype._handleIdResult=function (value) {
  12825. _super.prototype._handleIdResult.call(this, value);
  12826. if (_isNullOrUndefined(value)) {
  12827. return;
  12828. }
  12829. if (!_isUndefined(value["_ReferenceId"])) {
  12830. this.m__ReferenceId=value["_ReferenceId"];
  12831. }
  12832. if (!_isUndefined(value["Id"])) {
  12833. this.m_id=value["Id"];
  12834. }
  12835. };
  12836. Notebook.prototype.track=function () {
  12837. this.context.trackedObjects.add(this);
  12838. return this;
  12839. };
  12840. Notebook.prototype.untrack=function () {
  12841. this.context.trackedObjects.remove(this);
  12842. return this;
  12843. };
  12844. Notebook.prototype.toJSON=function () {
  12845. return {
  12846. "clientUrl": this.m_clientUrl,
  12847. "id": this.m_id,
  12848. "name": this.m_name
  12849. };
  12850. };
  12851. return Notebook;
  12852. }(OfficeExtension.ClientObject));
  12853. OneNote.Notebook=Notebook;
  12854. var NotebookCollection=(function (_super) {
  12855. __extends(NotebookCollection, _super);
  12856. function NotebookCollection() {
  12857. _super.apply(this, arguments);
  12858. }
  12859. Object.defineProperty(NotebookCollection.prototype, "items", {
  12860. get: function () {
  12861. _throwIfNotLoaded("items", this.m__items, "NotebookCollection", this._isNull);
  12862. return this.m__items;
  12863. },
  12864. enumerable: true,
  12865. configurable: true
  12866. });
  12867. Object.defineProperty(NotebookCollection.prototype, "count", {
  12868. get: function () {
  12869. _throwIfNotLoaded("count", this.m_count, "NotebookCollection", this._isNull);
  12870. return this.m_count;
  12871. },
  12872. enumerable: true,
  12873. configurable: true
  12874. });
  12875. Object.defineProperty(NotebookCollection.prototype, "_ReferenceId", {
  12876. get: function () {
  12877. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "NotebookCollection", this._isNull);
  12878. return this.m__ReferenceId;
  12879. },
  12880. enumerable: true,
  12881. configurable: true
  12882. });
  12883. NotebookCollection.prototype.getByName=function (name) {
  12884. return new OneNote.NotebookCollection(this.context, _createMethodObjectPath(this.context, this, "GetByName", OfficeExtension.OperationType.Read, [name], true, false, null));
  12885. };
  12886. NotebookCollection.prototype.getItem=function (index) {
  12887. return new OneNote.Notebook(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12888. };
  12889. NotebookCollection.prototype.getItemAt=function (index) {
  12890. return new OneNote.Notebook(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  12891. };
  12892. NotebookCollection.prototype._KeepReference=function () {
  12893. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12894. };
  12895. NotebookCollection.prototype._handleResult=function (value) {
  12896. _super.prototype._handleResult.call(this, value);
  12897. if (_isNullOrUndefined(value))
  12898. return;
  12899. var obj=value;
  12900. _fixObjectPathIfNecessary(this, obj);
  12901. if (!_isUndefined(obj["Count"])) {
  12902. this.m_count=obj["Count"];
  12903. }
  12904. if (!_isUndefined(obj["_ReferenceId"])) {
  12905. this.m__ReferenceId=obj["_ReferenceId"];
  12906. }
  12907. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12908. this.m__items=[];
  12909. var _data=obj[OfficeExtension.Constants.items];
  12910. for (var i=0; i < _data.length; i++) {
  12911. var _item=new OneNote.Notebook(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12912. _item._handleResult(_data[i]);
  12913. this.m__items.push(_item);
  12914. }
  12915. }
  12916. };
  12917. NotebookCollection.prototype.load=function (option) {
  12918. _load(this, option);
  12919. return this;
  12920. };
  12921. NotebookCollection.prototype._handleIdResult=function (value) {
  12922. _super.prototype._handleIdResult.call(this, value);
  12923. if (_isNullOrUndefined(value)) {
  12924. return;
  12925. }
  12926. if (!_isUndefined(value["_ReferenceId"])) {
  12927. this.m__ReferenceId=value["_ReferenceId"];
  12928. }
  12929. };
  12930. NotebookCollection.prototype.track=function () {
  12931. this.context.trackedObjects.add(this);
  12932. return this;
  12933. };
  12934. NotebookCollection.prototype.untrack=function () {
  12935. this.context.trackedObjects.remove(this);
  12936. return this;
  12937. };
  12938. NotebookCollection.prototype.toJSON=function () {
  12939. return {
  12940. "count": this.m_count
  12941. };
  12942. };
  12943. return NotebookCollection;
  12944. }(OfficeExtension.ClientObject));
  12945. OneNote.NotebookCollection=NotebookCollection;
  12946. var SectionGroup=(function (_super) {
  12947. __extends(SectionGroup, _super);
  12948. function SectionGroup() {
  12949. _super.apply(this, arguments);
  12950. }
  12951. Object.defineProperty(SectionGroup.prototype, "notebook", {
  12952. get: function () {
  12953. if (!this.m_notebook) {
  12954. this.m_notebook=new OneNote.Notebook(this.context, _createPropertyObjectPath(this.context, this, "Notebook", false, false));
  12955. }
  12956. return this.m_notebook;
  12957. },
  12958. enumerable: true,
  12959. configurable: true
  12960. });
  12961. Object.defineProperty(SectionGroup.prototype, "parentSectionGroup", {
  12962. get: function () {
  12963. if (!this.m_parentSectionGroup) {
  12964. this.m_parentSectionGroup=new OneNote.SectionGroup(this.context, _createPropertyObjectPath(this.context, this, "ParentSectionGroup", false, false));
  12965. }
  12966. return this.m_parentSectionGroup;
  12967. },
  12968. enumerable: true,
  12969. configurable: true
  12970. });
  12971. Object.defineProperty(SectionGroup.prototype, "parentSectionGroupOrNull", {
  12972. get: function () {
  12973. if (!this.m_parentSectionGroupOrNull) {
  12974. this.m_parentSectionGroupOrNull=new OneNote.SectionGroup(this.context, _createPropertyObjectPath(this.context, this, "ParentSectionGroupOrNull", false, false));
  12975. }
  12976. return this.m_parentSectionGroupOrNull;
  12977. },
  12978. enumerable: true,
  12979. configurable: true
  12980. });
  12981. Object.defineProperty(SectionGroup.prototype, "sectionGroups", {
  12982. get: function () {
  12983. if (!this.m_sectionGroups) {
  12984. this.m_sectionGroups=new OneNote.SectionGroupCollection(this.context, _createPropertyObjectPath(this.context, this, "SectionGroups", true, false));
  12985. }
  12986. return this.m_sectionGroups;
  12987. },
  12988. enumerable: true,
  12989. configurable: true
  12990. });
  12991. Object.defineProperty(SectionGroup.prototype, "sections", {
  12992. get: function () {
  12993. if (!this.m_sections) {
  12994. this.m_sections=new OneNote.SectionCollection(this.context, _createPropertyObjectPath(this.context, this, "Sections", true, false));
  12995. }
  12996. return this.m_sections;
  12997. },
  12998. enumerable: true,
  12999. configurable: true
  13000. });
  13001. Object.defineProperty(SectionGroup.prototype, "clientUrl", {
  13002. get: function () {
  13003. _throwIfNotLoaded("clientUrl", this.m_clientUrl, "SectionGroup", this._isNull);
  13004. return this.m_clientUrl;
  13005. },
  13006. enumerable: true,
  13007. configurable: true
  13008. });
  13009. Object.defineProperty(SectionGroup.prototype, "id", {
  13010. get: function () {
  13011. _throwIfNotLoaded("id", this.m_id, "SectionGroup", this._isNull);
  13012. return this.m_id;
  13013. },
  13014. enumerable: true,
  13015. configurable: true
  13016. });
  13017. Object.defineProperty(SectionGroup.prototype, "name", {
  13018. get: function () {
  13019. _throwIfNotLoaded("name", this.m_name, "SectionGroup", this._isNull);
  13020. return this.m_name;
  13021. },
  13022. enumerable: true,
  13023. configurable: true
  13024. });
  13025. Object.defineProperty(SectionGroup.prototype, "_ReferenceId", {
  13026. get: function () {
  13027. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionGroup", this._isNull);
  13028. return this.m__ReferenceId;
  13029. },
  13030. enumerable: true,
  13031. configurable: true
  13032. });
  13033. SectionGroup.prototype.addSection=function (title) {
  13034. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "AddSection", OfficeExtension.OperationType.Default, [title], false, true, null));
  13035. };
  13036. SectionGroup.prototype.addSectionGroup=function (name) {
  13037. return new OneNote.SectionGroup(this.context, _createMethodObjectPath(this.context, this, "AddSectionGroup", OfficeExtension.OperationType.Default, [name], false, true, null));
  13038. };
  13039. SectionGroup.prototype._KeepReference=function () {
  13040. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13041. };
  13042. SectionGroup.prototype._handleResult=function (value) {
  13043. _super.prototype._handleResult.call(this, value);
  13044. if (_isNullOrUndefined(value))
  13045. return;
  13046. var obj=value;
  13047. _fixObjectPathIfNecessary(this, obj);
  13048. if (!_isUndefined(obj["ClientUrl"])) {
  13049. this.m_clientUrl=obj["ClientUrl"];
  13050. }
  13051. if (!_isUndefined(obj["Id"])) {
  13052. this.m_id=obj["Id"];
  13053. }
  13054. if (!_isUndefined(obj["Name"])) {
  13055. this.m_name=obj["Name"];
  13056. }
  13057. if (!_isUndefined(obj["_ReferenceId"])) {
  13058. this.m__ReferenceId=obj["_ReferenceId"];
  13059. }
  13060. _handleNavigationPropertyResults(this, obj, ["notebook", "Notebook", "parentSectionGroup", "ParentSectionGroup", "parentSectionGroupOrNull", "ParentSectionGroupOrNull", "sectionGroups", "SectionGroups", "sections", "Sections"]);
  13061. };
  13062. SectionGroup.prototype.load=function (option) {
  13063. _load(this, option);
  13064. return this;
  13065. };
  13066. SectionGroup.prototype._handleIdResult=function (value) {
  13067. _super.prototype._handleIdResult.call(this, value);
  13068. if (_isNullOrUndefined(value)) {
  13069. return;
  13070. }
  13071. if (!_isUndefined(value["_ReferenceId"])) {
  13072. this.m__ReferenceId=value["_ReferenceId"];
  13073. }
  13074. if (!_isUndefined(value["Id"])) {
  13075. this.m_id=value["Id"];
  13076. }
  13077. };
  13078. SectionGroup.prototype.track=function () {
  13079. this.context.trackedObjects.add(this);
  13080. return this;
  13081. };
  13082. SectionGroup.prototype.untrack=function () {
  13083. this.context.trackedObjects.remove(this);
  13084. return this;
  13085. };
  13086. SectionGroup.prototype.toJSON=function () {
  13087. return {
  13088. "clientUrl": this.m_clientUrl,
  13089. "id": this.m_id,
  13090. "name": this.m_name
  13091. };
  13092. };
  13093. return SectionGroup;
  13094. }(OfficeExtension.ClientObject));
  13095. OneNote.SectionGroup=SectionGroup;
  13096. var SectionGroupCollection=(function (_super) {
  13097. __extends(SectionGroupCollection, _super);
  13098. function SectionGroupCollection() {
  13099. _super.apply(this, arguments);
  13100. }
  13101. Object.defineProperty(SectionGroupCollection.prototype, "items", {
  13102. get: function () {
  13103. _throwIfNotLoaded("items", this.m__items, "SectionGroupCollection", this._isNull);
  13104. return this.m__items;
  13105. },
  13106. enumerable: true,
  13107. configurable: true
  13108. });
  13109. Object.defineProperty(SectionGroupCollection.prototype, "count", {
  13110. get: function () {
  13111. _throwIfNotLoaded("count", this.m_count, "SectionGroupCollection", this._isNull);
  13112. return this.m_count;
  13113. },
  13114. enumerable: true,
  13115. configurable: true
  13116. });
  13117. Object.defineProperty(SectionGroupCollection.prototype, "_ReferenceId", {
  13118. get: function () {
  13119. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionGroupCollection", this._isNull);
  13120. return this.m__ReferenceId;
  13121. },
  13122. enumerable: true,
  13123. configurable: true
  13124. });
  13125. SectionGroupCollection.prototype.getByName=function (name) {
  13126. return new OneNote.SectionGroupCollection(this.context, _createMethodObjectPath(this.context, this, "GetByName", OfficeExtension.OperationType.Read, [name], true, false, null));
  13127. };
  13128. SectionGroupCollection.prototype.getItem=function (index) {
  13129. return new OneNote.SectionGroup(this.context, _createIndexerObjectPath(this.context, this, [index]));
  13130. };
  13131. SectionGroupCollection.prototype.getItemAt=function (index) {
  13132. return new OneNote.SectionGroup(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  13133. };
  13134. SectionGroupCollection.prototype._KeepReference=function () {
  13135. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13136. };
  13137. SectionGroupCollection.prototype._handleResult=function (value) {
  13138. _super.prototype._handleResult.call(this, value);
  13139. if (_isNullOrUndefined(value))
  13140. return;
  13141. var obj=value;
  13142. _fixObjectPathIfNecessary(this, obj);
  13143. if (!_isUndefined(obj["Count"])) {
  13144. this.m_count=obj["Count"];
  13145. }
  13146. if (!_isUndefined(obj["_ReferenceId"])) {
  13147. this.m__ReferenceId=obj["_ReferenceId"];
  13148. }
  13149. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  13150. this.m__items=[];
  13151. var _data=obj[OfficeExtension.Constants.items];
  13152. for (var i=0; i < _data.length; i++) {
  13153. var _item=new OneNote.SectionGroup(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  13154. _item._handleResult(_data[i]);
  13155. this.m__items.push(_item);
  13156. }
  13157. }
  13158. };
  13159. SectionGroupCollection.prototype.load=function (option) {
  13160. _load(this, option);
  13161. return this;
  13162. };
  13163. SectionGroupCollection.prototype._handleIdResult=function (value) {
  13164. _super.prototype._handleIdResult.call(this, value);
  13165. if (_isNullOrUndefined(value)) {
  13166. return;
  13167. }
  13168. if (!_isUndefined(value["_ReferenceId"])) {
  13169. this.m__ReferenceId=value["_ReferenceId"];
  13170. }
  13171. };
  13172. SectionGroupCollection.prototype.track=function () {
  13173. this.context.trackedObjects.add(this);
  13174. return this;
  13175. };
  13176. SectionGroupCollection.prototype.untrack=function () {
  13177. this.context.trackedObjects.remove(this);
  13178. return this;
  13179. };
  13180. SectionGroupCollection.prototype.toJSON=function () {
  13181. return {
  13182. "count": this.m_count
  13183. };
  13184. };
  13185. return SectionGroupCollection;
  13186. }(OfficeExtension.ClientObject));
  13187. OneNote.SectionGroupCollection=SectionGroupCollection;
  13188. var Section=(function (_super) {
  13189. __extends(Section, _super);
  13190. function Section() {
  13191. _super.apply(this, arguments);
  13192. }
  13193. Object.defineProperty(Section.prototype, "notebook", {
  13194. get: function () {
  13195. if (!this.m_notebook) {
  13196. this.m_notebook=new OneNote.Notebook(this.context, _createPropertyObjectPath(this.context, this, "Notebook", false, false));
  13197. }
  13198. return this.m_notebook;
  13199. },
  13200. enumerable: true,
  13201. configurable: true
  13202. });
  13203. Object.defineProperty(Section.prototype, "pages", {
  13204. get: function () {
  13205. if (!this.m_pages) {
  13206. this.m_pages=new OneNote.PageCollection(this.context, _createPropertyObjectPath(this.context, this, "Pages", true, false));
  13207. }
  13208. return this.m_pages;
  13209. },
  13210. enumerable: true,
  13211. configurable: true
  13212. });
  13213. Object.defineProperty(Section.prototype, "parentSectionGroup", {
  13214. get: function () {
  13215. if (!this.m_parentSectionGroup) {
  13216. this.m_parentSectionGroup=new OneNote.SectionGroup(this.context, _createPropertyObjectPath(this.context, this, "ParentSectionGroup", false, false));
  13217. }
  13218. return this.m_parentSectionGroup;
  13219. },
  13220. enumerable: true,
  13221. configurable: true
  13222. });
  13223. Object.defineProperty(Section.prototype, "parentSectionGroupOrNull", {
  13224. get: function () {
  13225. if (!this.m_parentSectionGroupOrNull) {
  13226. this.m_parentSectionGroupOrNull=new OneNote.SectionGroup(this.context, _createPropertyObjectPath(this.context, this, "ParentSectionGroupOrNull", false, false));
  13227. }
  13228. return this.m_parentSectionGroupOrNull;
  13229. },
  13230. enumerable: true,
  13231. configurable: true
  13232. });
  13233. Object.defineProperty(Section.prototype, "clientUrl", {
  13234. get: function () {
  13235. _throwIfNotLoaded("clientUrl", this.m_clientUrl, "Section", this._isNull);
  13236. return this.m_clientUrl;
  13237. },
  13238. enumerable: true,
  13239. configurable: true
  13240. });
  13241. Object.defineProperty(Section.prototype, "id", {
  13242. get: function () {
  13243. _throwIfNotLoaded("id", this.m_id, "Section", this._isNull);
  13244. return this.m_id;
  13245. },
  13246. enumerable: true,
  13247. configurable: true
  13248. });
  13249. Object.defineProperty(Section.prototype, "name", {
  13250. get: function () {
  13251. _throwIfNotLoaded("name", this.m_name, "Section", this._isNull);
  13252. return this.m_name;
  13253. },
  13254. enumerable: true,
  13255. configurable: true
  13256. });
  13257. Object.defineProperty(Section.prototype, "_ReferenceId", {
  13258. get: function () {
  13259. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Section", this._isNull);
  13260. return this.m__ReferenceId;
  13261. },
  13262. enumerable: true,
  13263. configurable: true
  13264. });
  13265. Section.prototype.addPage=function (title) {
  13266. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "AddPage", OfficeExtension.OperationType.Default, [title], false, true, null));
  13267. };
  13268. Section.prototype.copyToNotebook=function (destinationNotebook) {
  13269. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "CopyToNotebook", OfficeExtension.OperationType.Default, [destinationNotebook], false, true, null));
  13270. };
  13271. Section.prototype.copyToSectionGroup=function (destinationSectionGroup) {
  13272. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "CopyToSectionGroup", OfficeExtension.OperationType.Default, [destinationSectionGroup], false, true, null));
  13273. };
  13274. Section.prototype.insertSectionAsSibling=function (location, title) {
  13275. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "InsertSectionAsSibling", OfficeExtension.OperationType.Default, [location, title], false, true, null));
  13276. };
  13277. Section.prototype._KeepReference=function () {
  13278. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13279. };
  13280. Section.prototype._handleResult=function (value) {
  13281. _super.prototype._handleResult.call(this, value);
  13282. if (_isNullOrUndefined(value))
  13283. return;
  13284. var obj=value;
  13285. _fixObjectPathIfNecessary(this, obj);
  13286. if (!_isUndefined(obj["ClientUrl"])) {
  13287. this.m_clientUrl=obj["ClientUrl"];
  13288. }
  13289. if (!_isUndefined(obj["Id"])) {
  13290. this.m_id=obj["Id"];
  13291. }
  13292. if (!_isUndefined(obj["Name"])) {
  13293. this.m_name=obj["Name"];
  13294. }
  13295. if (!_isUndefined(obj["_ReferenceId"])) {
  13296. this.m__ReferenceId=obj["_ReferenceId"];
  13297. }
  13298. _handleNavigationPropertyResults(this, obj, ["notebook", "Notebook", "pages", "Pages", "parentSectionGroup", "ParentSectionGroup", "parentSectionGroupOrNull", "ParentSectionGroupOrNull"]);
  13299. };
  13300. Section.prototype.load=function (option) {
  13301. _load(this, option);
  13302. return this;
  13303. };
  13304. Section.prototype._handleIdResult=function (value) {
  13305. _super.prototype._handleIdResult.call(this, value);
  13306. if (_isNullOrUndefined(value)) {
  13307. return;
  13308. }
  13309. if (!_isUndefined(value["_ReferenceId"])) {
  13310. this.m__ReferenceId=value["_ReferenceId"];
  13311. }
  13312. if (!_isUndefined(value["Id"])) {
  13313. this.m_id=value["Id"];
  13314. }
  13315. };
  13316. Section.prototype.track=function () {
  13317. this.context.trackedObjects.add(this);
  13318. return this;
  13319. };
  13320. Section.prototype.untrack=function () {
  13321. this.context.trackedObjects.remove(this);
  13322. return this;
  13323. };
  13324. Section.prototype.toJSON=function () {
  13325. return {
  13326. "clientUrl": this.m_clientUrl,
  13327. "id": this.m_id,
  13328. "name": this.m_name
  13329. };
  13330. };
  13331. return Section;
  13332. }(OfficeExtension.ClientObject));
  13333. OneNote.Section=Section;
  13334. var SectionCollection=(function (_super) {
  13335. __extends(SectionCollection, _super);
  13336. function SectionCollection() {
  13337. _super.apply(this, arguments);
  13338. }
  13339. Object.defineProperty(SectionCollection.prototype, "items", {
  13340. get: function () {
  13341. _throwIfNotLoaded("items", this.m__items, "SectionCollection", this._isNull);
  13342. return this.m__items;
  13343. },
  13344. enumerable: true,
  13345. configurable: true
  13346. });
  13347. Object.defineProperty(SectionCollection.prototype, "count", {
  13348. get: function () {
  13349. _throwIfNotLoaded("count", this.m_count, "SectionCollection", this._isNull);
  13350. return this.m_count;
  13351. },
  13352. enumerable: true,
  13353. configurable: true
  13354. });
  13355. Object.defineProperty(SectionCollection.prototype, "_ReferenceId", {
  13356. get: function () {
  13357. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionCollection", this._isNull);
  13358. return this.m__ReferenceId;
  13359. },
  13360. enumerable: true,
  13361. configurable: true
  13362. });
  13363. SectionCollection.prototype.getByName=function (name) {
  13364. return new OneNote.SectionCollection(this.context, _createMethodObjectPath(this.context, this, "GetByName", OfficeExtension.OperationType.Read, [name], true, false, null));
  13365. };
  13366. SectionCollection.prototype.getItem=function (index) {
  13367. return new OneNote.Section(this.context, _createIndexerObjectPath(this.context, this, [index]));
  13368. };
  13369. SectionCollection.prototype.getItemAt=function (index) {
  13370. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  13371. };
  13372. SectionCollection.prototype._KeepReference=function () {
  13373. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13374. };
  13375. SectionCollection.prototype._handleResult=function (value) {
  13376. _super.prototype._handleResult.call(this, value);
  13377. if (_isNullOrUndefined(value))
  13378. return;
  13379. var obj=value;
  13380. _fixObjectPathIfNecessary(this, obj);
  13381. if (!_isUndefined(obj["Count"])) {
  13382. this.m_count=obj["Count"];
  13383. }
  13384. if (!_isUndefined(obj["_ReferenceId"])) {
  13385. this.m__ReferenceId=obj["_ReferenceId"];
  13386. }
  13387. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  13388. this.m__items=[];
  13389. var _data=obj[OfficeExtension.Constants.items];
  13390. for (var i=0; i < _data.length; i++) {
  13391. var _item=new OneNote.Section(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  13392. _item._handleResult(_data[i]);
  13393. this.m__items.push(_item);
  13394. }
  13395. }
  13396. };
  13397. SectionCollection.prototype.load=function (option) {
  13398. _load(this, option);
  13399. return this;
  13400. };
  13401. SectionCollection.prototype._handleIdResult=function (value) {
  13402. _super.prototype._handleIdResult.call(this, value);
  13403. if (_isNullOrUndefined(value)) {
  13404. return;
  13405. }
  13406. if (!_isUndefined(value["_ReferenceId"])) {
  13407. this.m__ReferenceId=value["_ReferenceId"];
  13408. }
  13409. };
  13410. SectionCollection.prototype.track=function () {
  13411. this.context.trackedObjects.add(this);
  13412. return this;
  13413. };
  13414. SectionCollection.prototype.untrack=function () {
  13415. this.context.trackedObjects.remove(this);
  13416. return this;
  13417. };
  13418. SectionCollection.prototype.toJSON=function () {
  13419. return {
  13420. "count": this.m_count
  13421. };
  13422. };
  13423. return SectionCollection;
  13424. }(OfficeExtension.ClientObject));
  13425. OneNote.SectionCollection=SectionCollection;
  13426. var Page=(function (_super) {
  13427. __extends(Page, _super);
  13428. function Page() {
  13429. _super.apply(this, arguments);
  13430. }
  13431. Object.defineProperty(Page.prototype, "contents", {
  13432. get: function () {
  13433. if (!this.m_contents) {
  13434. this.m_contents=new OneNote.PageContentCollection(this.context, _createPropertyObjectPath(this.context, this, "Contents", true, false));
  13435. }
  13436. return this.m_contents;
  13437. },
  13438. enumerable: true,
  13439. configurable: true
  13440. });
  13441. Object.defineProperty(Page.prototype, "inkAnalysisOrNull", {
  13442. get: function () {
  13443. if (!this.m_inkAnalysisOrNull) {
  13444. this.m_inkAnalysisOrNull=new OneNote.InkAnalysis(this.context, _createPropertyObjectPath(this.context, this, "InkAnalysisOrNull", false, false));
  13445. }
  13446. return this.m_inkAnalysisOrNull;
  13447. },
  13448. enumerable: true,
  13449. configurable: true
  13450. });
  13451. Object.defineProperty(Page.prototype, "parentSection", {
  13452. get: function () {
  13453. if (!this.m_parentSection) {
  13454. this.m_parentSection=new OneNote.Section(this.context, _createPropertyObjectPath(this.context, this, "ParentSection", false, false));
  13455. }
  13456. return this.m_parentSection;
  13457. },
  13458. enumerable: true,
  13459. configurable: true
  13460. });
  13461. Object.defineProperty(Page.prototype, "classNotebookPageSource", {
  13462. get: function () {
  13463. _throwIfNotLoaded("classNotebookPageSource", this.m_classNotebookPageSource, "Page", this._isNull);
  13464. return this.m_classNotebookPageSource;
  13465. },
  13466. enumerable: true,
  13467. configurable: true
  13468. });
  13469. Object.defineProperty(Page.prototype, "clientUrl", {
  13470. get: function () {
  13471. _throwIfNotLoaded("clientUrl", this.m_clientUrl, "Page", this._isNull);
  13472. return this.m_clientUrl;
  13473. },
  13474. enumerable: true,
  13475. configurable: true
  13476. });
  13477. Object.defineProperty(Page.prototype, "id", {
  13478. get: function () {
  13479. _throwIfNotLoaded("id", this.m_id, "Page", this._isNull);
  13480. return this.m_id;
  13481. },
  13482. enumerable: true,
  13483. configurable: true
  13484. });
  13485. Object.defineProperty(Page.prototype, "pageLevel", {
  13486. get: function () {
  13487. _throwIfNotLoaded("pageLevel", this.m_pageLevel, "Page", this._isNull);
  13488. return this.m_pageLevel;
  13489. },
  13490. set: function (value) {
  13491. this.m_pageLevel=value;
  13492. _createSetPropertyAction(this.context, this, "PageLevel", value);
  13493. },
  13494. enumerable: true,
  13495. configurable: true
  13496. });
  13497. Object.defineProperty(Page.prototype, "title", {
  13498. get: function () {
  13499. _throwIfNotLoaded("title", this.m_title, "Page", this._isNull);
  13500. return this.m_title;
  13501. },
  13502. set: function (value) {
  13503. this.m_title=value;
  13504. _createSetPropertyAction(this.context, this, "Title", value);
  13505. },
  13506. enumerable: true,
  13507. configurable: true
  13508. });
  13509. Object.defineProperty(Page.prototype, "webUrl", {
  13510. get: function () {
  13511. _throwIfNotLoaded("webUrl", this.m_webUrl, "Page", this._isNull);
  13512. return this.m_webUrl;
  13513. },
  13514. enumerable: true,
  13515. configurable: true
  13516. });
  13517. Object.defineProperty(Page.prototype, "_ReferenceId", {
  13518. get: function () {
  13519. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Page", this._isNull);
  13520. return this.m__ReferenceId;
  13521. },
  13522. enumerable: true,
  13523. configurable: true
  13524. });
  13525. Page.prototype.addOutline=function (left, top, html) {
  13526. return new OneNote.Outline(this.context, _createMethodObjectPath(this.context, this, "AddOutline", OfficeExtension.OperationType.Default, [left, top, html], false, true, null));
  13527. };
  13528. Page.prototype.copyToSection=function (destinationSection) {
  13529. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "CopyToSection", OfficeExtension.OperationType.Default, [destinationSection], false, true, null));
  13530. };
  13531. Page.prototype.copyToSectionAndSetClassNotebookPageSource=function (destinationSection) {
  13532. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "CopyToSectionAndSetClassNotebookPageSource", OfficeExtension.OperationType.Default, [destinationSection], false, true, null));
  13533. };
  13534. Page.prototype.insertPageAsSibling=function (location, title) {
  13535. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "InsertPageAsSibling", OfficeExtension.OperationType.Default, [location, title], false, true, null));
  13536. };
  13537. Page.prototype._KeepReference=function () {
  13538. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13539. };
  13540. Page.prototype._Sync=function () {
  13541. _createMethodAction(this.context, this, "_Sync", OfficeExtension.OperationType.Default, []);
  13542. };
  13543. Page.prototype._handleResult=function (value) {
  13544. _super.prototype._handleResult.call(this, value);
  13545. if (_isNullOrUndefined(value))
  13546. return;
  13547. var obj=value;
  13548. _fixObjectPathIfNecessary(this, obj);
  13549. if (!_isUndefined(obj["ClassNotebookPageSource"])) {
  13550. this.m_classNotebookPageSource=obj["ClassNotebookPageSource"];
  13551. }
  13552. if (!_isUndefined(obj["ClientUrl"])) {
  13553. this.m_clientUrl=obj["ClientUrl"];
  13554. }
  13555. if (!_isUndefined(obj["Id"])) {
  13556. this.m_id=obj["Id"];
  13557. }
  13558. if (!_isUndefined(obj["PageLevel"])) {
  13559. this.m_pageLevel=obj["PageLevel"];
  13560. }
  13561. if (!_isUndefined(obj["Title"])) {
  13562. this.m_title=obj["Title"];
  13563. }
  13564. if (!_isUndefined(obj["WebUrl"])) {
  13565. this.m_webUrl=obj["WebUrl"];
  13566. }
  13567. if (!_isUndefined(obj["_ReferenceId"])) {
  13568. this.m__ReferenceId=obj["_ReferenceId"];
  13569. }
  13570. _handleNavigationPropertyResults(this, obj, ["contents", "Contents", "inkAnalysisOrNull", "InkAnalysisOrNull", "parentSection", "ParentSection"]);
  13571. };
  13572. Page.prototype.load=function (option) {
  13573. _load(this, option);
  13574. return this;
  13575. };
  13576. Page.prototype._handleIdResult=function (value) {
  13577. _super.prototype._handleIdResult.call(this, value);
  13578. if (_isNullOrUndefined(value)) {
  13579. return;
  13580. }
  13581. if (!_isUndefined(value["_ReferenceId"])) {
  13582. this.m__ReferenceId=value["_ReferenceId"];
  13583. }
  13584. if (!_isUndefined(value["Id"])) {
  13585. this.m_id=value["Id"];
  13586. }
  13587. };
  13588. Page.prototype.track=function () {
  13589. this.context.trackedObjects.add(this);
  13590. return this;
  13591. };
  13592. Page.prototype.untrack=function () {
  13593. this.context.trackedObjects.remove(this);
  13594. return this;
  13595. };
  13596. Page.prototype.toJSON=function () {
  13597. return {
  13598. "classNotebookPageSource": this.m_classNotebookPageSource,
  13599. "clientUrl": this.m_clientUrl,
  13600. "id": this.m_id,
  13601. "pageLevel": this.m_pageLevel,
  13602. "title": this.m_title,
  13603. "webUrl": this.m_webUrl
  13604. };
  13605. };
  13606. return Page;
  13607. }(OfficeExtension.ClientObject));
  13608. OneNote.Page=Page;
  13609. var PageCollection=(function (_super) {
  13610. __extends(PageCollection, _super);
  13611. function PageCollection() {
  13612. _super.apply(this, arguments);
  13613. }
  13614. Object.defineProperty(PageCollection.prototype, "items", {
  13615. get: function () {
  13616. _throwIfNotLoaded("items", this.m__items, "PageCollection", this._isNull);
  13617. return this.m__items;
  13618. },
  13619. enumerable: true,
  13620. configurable: true
  13621. });
  13622. Object.defineProperty(PageCollection.prototype, "count", {
  13623. get: function () {
  13624. _throwIfNotLoaded("count", this.m_count, "PageCollection", this._isNull);
  13625. return this.m_count;
  13626. },
  13627. enumerable: true,
  13628. configurable: true
  13629. });
  13630. Object.defineProperty(PageCollection.prototype, "_ReferenceId", {
  13631. get: function () {
  13632. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "PageCollection", this._isNull);
  13633. return this.m__ReferenceId;
  13634. },
  13635. enumerable: true,
  13636. configurable: true
  13637. });
  13638. PageCollection.prototype.getByTitle=function (title) {
  13639. return new OneNote.PageCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTitle", OfficeExtension.OperationType.Read, [title], true, false, null));
  13640. };
  13641. PageCollection.prototype.getItem=function (index) {
  13642. return new OneNote.Page(this.context, _createIndexerObjectPath(this.context, this, [index]));
  13643. };
  13644. PageCollection.prototype.getItemAt=function (index) {
  13645. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  13646. };
  13647. PageCollection.prototype._KeepReference=function () {
  13648. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13649. };
  13650. PageCollection.prototype._handleResult=function (value) {
  13651. _super.prototype._handleResult.call(this, value);
  13652. if (_isNullOrUndefined(value))
  13653. return;
  13654. var obj=value;
  13655. _fixObjectPathIfNecessary(this, obj);
  13656. if (!_isUndefined(obj["Count"])) {
  13657. this.m_count=obj["Count"];
  13658. }
  13659. if (!_isUndefined(obj["_ReferenceId"])) {
  13660. this.m__ReferenceId=obj["_ReferenceId"];
  13661. }
  13662. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  13663. this.m__items=[];
  13664. var _data=obj[OfficeExtension.Constants.items];
  13665. for (var i=0; i < _data.length; i++) {
  13666. var _item=new OneNote.Page(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  13667. _item._handleResult(_data[i]);
  13668. this.m__items.push(_item);
  13669. }
  13670. }
  13671. };
  13672. PageCollection.prototype.load=function (option) {
  13673. _load(this, option);
  13674. return this;
  13675. };
  13676. PageCollection.prototype._handleIdResult=function (value) {
  13677. _super.prototype._handleIdResult.call(this, value);
  13678. if (_isNullOrUndefined(value)) {
  13679. return;
  13680. }
  13681. if (!_isUndefined(value["_ReferenceId"])) {
  13682. this.m__ReferenceId=value["_ReferenceId"];
  13683. }
  13684. };
  13685. PageCollection.prototype.track=function () {
  13686. this.context.trackedObjects.add(this);
  13687. return this;
  13688. };
  13689. PageCollection.prototype.untrack=function () {
  13690. this.context.trackedObjects.remove(this);
  13691. return this;
  13692. };
  13693. PageCollection.prototype.toJSON=function () {
  13694. return {
  13695. "count": this.m_count
  13696. };
  13697. };
  13698. return PageCollection;
  13699. }(OfficeExtension.ClientObject));
  13700. OneNote.PageCollection=PageCollection;
  13701. var PageContent=(function (_super) {
  13702. __extends(PageContent, _super);
  13703. function PageContent() {
  13704. _super.apply(this, arguments);
  13705. }
  13706. Object.defineProperty(PageContent.prototype, "image", {
  13707. get: function () {
  13708. if (!this.m_image) {
  13709. this.m_image=new OneNote.Image(this.context, _createPropertyObjectPath(this.context, this, "Image", false, false));
  13710. }
  13711. return this.m_image;
  13712. },
  13713. enumerable: true,
  13714. configurable: true
  13715. });
  13716. Object.defineProperty(PageContent.prototype, "ink", {
  13717. get: function () {
  13718. if (!this.m_ink) {
  13719. this.m_ink=new OneNote.FloatingInk(this.context, _createPropertyObjectPath(this.context, this, "Ink", false, false));
  13720. }
  13721. return this.m_ink;
  13722. },
  13723. enumerable: true,
  13724. configurable: true
  13725. });
  13726. Object.defineProperty(PageContent.prototype, "outline", {
  13727. get: function () {
  13728. if (!this.m_outline) {
  13729. this.m_outline=new OneNote.Outline(this.context, _createPropertyObjectPath(this.context, this, "Outline", false, false));
  13730. }
  13731. return this.m_outline;
  13732. },
  13733. enumerable: true,
  13734. configurable: true
  13735. });
  13736. Object.defineProperty(PageContent.prototype, "parentPage", {
  13737. get: function () {
  13738. if (!this.m_parentPage) {
  13739. this.m_parentPage=new OneNote.Page(this.context, _createPropertyObjectPath(this.context, this, "ParentPage", false, false));
  13740. }
  13741. return this.m_parentPage;
  13742. },
  13743. enumerable: true,
  13744. configurable: true
  13745. });
  13746. Object.defineProperty(PageContent.prototype, "id", {
  13747. get: function () {
  13748. _throwIfNotLoaded("id", this.m_id, "PageContent", this._isNull);
  13749. return this.m_id;
  13750. },
  13751. enumerable: true,
  13752. configurable: true
  13753. });
  13754. Object.defineProperty(PageContent.prototype, "left", {
  13755. get: function () {
  13756. _throwIfNotLoaded("left", this.m_left, "PageContent", this._isNull);
  13757. return this.m_left;
  13758. },
  13759. set: function (value) {
  13760. this.m_left=value;
  13761. _createSetPropertyAction(this.context, this, "Left", value);
  13762. },
  13763. enumerable: true,
  13764. configurable: true
  13765. });
  13766. Object.defineProperty(PageContent.prototype, "top", {
  13767. get: function () {
  13768. _throwIfNotLoaded("top", this.m_top, "PageContent", this._isNull);
  13769. return this.m_top;
  13770. },
  13771. set: function (value) {
  13772. this.m_top=value;
  13773. _createSetPropertyAction(this.context, this, "Top", value);
  13774. },
  13775. enumerable: true,
  13776. configurable: true
  13777. });
  13778. Object.defineProperty(PageContent.prototype, "type", {
  13779. get: function () {
  13780. _throwIfNotLoaded("type", this.m_type, "PageContent", this._isNull);
  13781. return this.m_type;
  13782. },
  13783. enumerable: true,
  13784. configurable: true
  13785. });
  13786. Object.defineProperty(PageContent.prototype, "_ReferenceId", {
  13787. get: function () {
  13788. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "PageContent", this._isNull);
  13789. return this.m__ReferenceId;
  13790. },
  13791. enumerable: true,
  13792. configurable: true
  13793. });
  13794. PageContent.prototype.delete=function () {
  13795. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, []);
  13796. };
  13797. PageContent.prototype._KeepReference=function () {
  13798. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13799. };
  13800. PageContent.prototype._handleResult=function (value) {
  13801. _super.prototype._handleResult.call(this, value);
  13802. if (_isNullOrUndefined(value))
  13803. return;
  13804. var obj=value;
  13805. _fixObjectPathIfNecessary(this, obj);
  13806. if (!_isUndefined(obj["Id"])) {
  13807. this.m_id=obj["Id"];
  13808. }
  13809. if (!_isUndefined(obj["Left"])) {
  13810. this.m_left=obj["Left"];
  13811. }
  13812. if (!_isUndefined(obj["Top"])) {
  13813. this.m_top=obj["Top"];
  13814. }
  13815. if (!_isUndefined(obj["Type"])) {
  13816. this.m_type=obj["Type"];
  13817. }
  13818. if (!_isUndefined(obj["_ReferenceId"])) {
  13819. this.m__ReferenceId=obj["_ReferenceId"];
  13820. }
  13821. _handleNavigationPropertyResults(this, obj, ["image", "Image", "ink", "Ink", "outline", "Outline", "parentPage", "ParentPage"]);
  13822. };
  13823. PageContent.prototype.load=function (option) {
  13824. _load(this, option);
  13825. return this;
  13826. };
  13827. PageContent.prototype._handleIdResult=function (value) {
  13828. _super.prototype._handleIdResult.call(this, value);
  13829. if (_isNullOrUndefined(value)) {
  13830. return;
  13831. }
  13832. if (!_isUndefined(value["_ReferenceId"])) {
  13833. this.m__ReferenceId=value["_ReferenceId"];
  13834. }
  13835. if (!_isUndefined(value["Id"])) {
  13836. this.m_id=value["Id"];
  13837. }
  13838. };
  13839. PageContent.prototype.track=function () {
  13840. this.context.trackedObjects.add(this);
  13841. return this;
  13842. };
  13843. PageContent.prototype.untrack=function () {
  13844. this.context.trackedObjects.remove(this);
  13845. return this;
  13846. };
  13847. PageContent.prototype.toJSON=function () {
  13848. return {
  13849. "id": this.m_id,
  13850. "left": this.m_left,
  13851. "top": this.m_top,
  13852. "type": this.m_type
  13853. };
  13854. };
  13855. return PageContent;
  13856. }(OfficeExtension.ClientObject));
  13857. OneNote.PageContent=PageContent;
  13858. var PageContentCollection=(function (_super) {
  13859. __extends(PageContentCollection, _super);
  13860. function PageContentCollection() {
  13861. _super.apply(this, arguments);
  13862. }
  13863. Object.defineProperty(PageContentCollection.prototype, "items", {
  13864. get: function () {
  13865. _throwIfNotLoaded("items", this.m__items, "PageContentCollection", this._isNull);
  13866. return this.m__items;
  13867. },
  13868. enumerable: true,
  13869. configurable: true
  13870. });
  13871. Object.defineProperty(PageContentCollection.prototype, "count", {
  13872. get: function () {
  13873. _throwIfNotLoaded("count", this.m_count, "PageContentCollection", this._isNull);
  13874. return this.m_count;
  13875. },
  13876. enumerable: true,
  13877. configurable: true
  13878. });
  13879. Object.defineProperty(PageContentCollection.prototype, "_ReferenceId", {
  13880. get: function () {
  13881. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "PageContentCollection", this._isNull);
  13882. return this.m__ReferenceId;
  13883. },
  13884. enumerable: true,
  13885. configurable: true
  13886. });
  13887. PageContentCollection.prototype.getItem=function (index) {
  13888. return new OneNote.PageContent(this.context, _createIndexerObjectPath(this.context, this, [index]));
  13889. };
  13890. PageContentCollection.prototype.getItemAt=function (index) {
  13891. return new OneNote.PageContent(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  13892. };
  13893. PageContentCollection.prototype._KeepReference=function () {
  13894. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13895. };
  13896. PageContentCollection.prototype._handleResult=function (value) {
  13897. _super.prototype._handleResult.call(this, value);
  13898. if (_isNullOrUndefined(value))
  13899. return;
  13900. var obj=value;
  13901. _fixObjectPathIfNecessary(this, obj);
  13902. if (!_isUndefined(obj["Count"])) {
  13903. this.m_count=obj["Count"];
  13904. }
  13905. if (!_isUndefined(obj["_ReferenceId"])) {
  13906. this.m__ReferenceId=obj["_ReferenceId"];
  13907. }
  13908. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  13909. this.m__items=[];
  13910. var _data=obj[OfficeExtension.Constants.items];
  13911. for (var i=0; i < _data.length; i++) {
  13912. var _item=new OneNote.PageContent(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  13913. _item._handleResult(_data[i]);
  13914. this.m__items.push(_item);
  13915. }
  13916. }
  13917. };
  13918. PageContentCollection.prototype.load=function (option) {
  13919. _load(this, option);
  13920. return this;
  13921. };
  13922. PageContentCollection.prototype._handleIdResult=function (value) {
  13923. _super.prototype._handleIdResult.call(this, value);
  13924. if (_isNullOrUndefined(value)) {
  13925. return;
  13926. }
  13927. if (!_isUndefined(value["_ReferenceId"])) {
  13928. this.m__ReferenceId=value["_ReferenceId"];
  13929. }
  13930. };
  13931. PageContentCollection.prototype.track=function () {
  13932. this.context.trackedObjects.add(this);
  13933. return this;
  13934. };
  13935. PageContentCollection.prototype.untrack=function () {
  13936. this.context.trackedObjects.remove(this);
  13937. return this;
  13938. };
  13939. PageContentCollection.prototype.toJSON=function () {
  13940. return {
  13941. "count": this.m_count
  13942. };
  13943. };
  13944. return PageContentCollection;
  13945. }(OfficeExtension.ClientObject));
  13946. OneNote.PageContentCollection=PageContentCollection;
  13947. var Outline=(function (_super) {
  13948. __extends(Outline, _super);
  13949. function Outline() {
  13950. _super.apply(this, arguments);
  13951. }
  13952. Object.defineProperty(Outline.prototype, "pageContent", {
  13953. get: function () {
  13954. if (!this.m_pageContent) {
  13955. this.m_pageContent=new OneNote.PageContent(this.context, _createPropertyObjectPath(this.context, this, "PageContent", false, false));
  13956. }
  13957. return this.m_pageContent;
  13958. },
  13959. enumerable: true,
  13960. configurable: true
  13961. });
  13962. Object.defineProperty(Outline.prototype, "paragraphs", {
  13963. get: function () {
  13964. if (!this.m_paragraphs) {
  13965. this.m_paragraphs=new OneNote.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  13966. }
  13967. return this.m_paragraphs;
  13968. },
  13969. enumerable: true,
  13970. configurable: true
  13971. });
  13972. Object.defineProperty(Outline.prototype, "id", {
  13973. get: function () {
  13974. _throwIfNotLoaded("id", this.m_id, "Outline", this._isNull);
  13975. return this.m_id;
  13976. },
  13977. enumerable: true,
  13978. configurable: true
  13979. });
  13980. Object.defineProperty(Outline.prototype, "_ReferenceId", {
  13981. get: function () {
  13982. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Outline", this._isNull);
  13983. return this.m__ReferenceId;
  13984. },
  13985. enumerable: true,
  13986. configurable: true
  13987. });
  13988. Outline.prototype.appendHtml=function (html) {
  13989. _createMethodAction(this.context, this, "AppendHtml", OfficeExtension.OperationType.Default, [html]);
  13990. };
  13991. Outline.prototype.appendImage=function (base64EncodedImage, width, height) {
  13992. return new OneNote.Image(this.context, _createMethodObjectPath(this.context, this, "AppendImage", OfficeExtension.OperationType.Default, [base64EncodedImage, width, height], false, true, null));
  13993. };
  13994. Outline.prototype.appendRichText=function (paragraphText) {
  13995. return new OneNote.RichText(this.context, _createMethodObjectPath(this.context, this, "AppendRichText", OfficeExtension.OperationType.Default, [paragraphText], false, true, null));
  13996. };
  13997. Outline.prototype.appendTable=function (rowCount, columnCount, values) {
  13998. return new OneNote.Table(this.context, _createMethodObjectPath(this.context, this, "AppendTable", OfficeExtension.OperationType.Default, [rowCount, columnCount, values], false, true, null));
  13999. };
  14000. Outline.prototype._KeepReference=function () {
  14001. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14002. };
  14003. Outline.prototype._handleResult=function (value) {
  14004. _super.prototype._handleResult.call(this, value);
  14005. if (_isNullOrUndefined(value))
  14006. return;
  14007. var obj=value;
  14008. _fixObjectPathIfNecessary(this, obj);
  14009. if (!_isUndefined(obj["Id"])) {
  14010. this.m_id=obj["Id"];
  14011. }
  14012. if (!_isUndefined(obj["_ReferenceId"])) {
  14013. this.m__ReferenceId=obj["_ReferenceId"];
  14014. }
  14015. _handleNavigationPropertyResults(this, obj, ["pageContent", "PageContent", "paragraphs", "Paragraphs"]);
  14016. };
  14017. Outline.prototype.load=function (option) {
  14018. _load(this, option);
  14019. return this;
  14020. };
  14021. Outline.prototype._handleIdResult=function (value) {
  14022. _super.prototype._handleIdResult.call(this, value);
  14023. if (_isNullOrUndefined(value)) {
  14024. return;
  14025. }
  14026. if (!_isUndefined(value["_ReferenceId"])) {
  14027. this.m__ReferenceId=value["_ReferenceId"];
  14028. }
  14029. if (!_isUndefined(value["Id"])) {
  14030. this.m_id=value["Id"];
  14031. }
  14032. };
  14033. Outline.prototype.track=function () {
  14034. this.context.trackedObjects.add(this);
  14035. return this;
  14036. };
  14037. Outline.prototype.untrack=function () {
  14038. this.context.trackedObjects.remove(this);
  14039. return this;
  14040. };
  14041. Outline.prototype.toJSON=function () {
  14042. return {
  14043. "id": this.m_id
  14044. };
  14045. };
  14046. return Outline;
  14047. }(OfficeExtension.ClientObject));
  14048. OneNote.Outline=Outline;
  14049. var Paragraph=(function (_super) {
  14050. __extends(Paragraph, _super);
  14051. function Paragraph() {
  14052. _super.apply(this, arguments);
  14053. }
  14054. Object.defineProperty(Paragraph.prototype, "image", {
  14055. get: function () {
  14056. if (!this.m_image) {
  14057. this.m_image=new OneNote.Image(this.context, _createPropertyObjectPath(this.context, this, "Image", false, false));
  14058. }
  14059. return this.m_image;
  14060. },
  14061. enumerable: true,
  14062. configurable: true
  14063. });
  14064. Object.defineProperty(Paragraph.prototype, "inkWords", {
  14065. get: function () {
  14066. if (!this.m_inkWords) {
  14067. this.m_inkWords=new OneNote.InkWordCollection(this.context, _createPropertyObjectPath(this.context, this, "InkWords", true, false));
  14068. }
  14069. return this.m_inkWords;
  14070. },
  14071. enumerable: true,
  14072. configurable: true
  14073. });
  14074. Object.defineProperty(Paragraph.prototype, "outline", {
  14075. get: function () {
  14076. if (!this.m_outline) {
  14077. this.m_outline=new OneNote.Outline(this.context, _createPropertyObjectPath(this.context, this, "Outline", false, false));
  14078. }
  14079. return this.m_outline;
  14080. },
  14081. enumerable: true,
  14082. configurable: true
  14083. });
  14084. Object.defineProperty(Paragraph.prototype, "paragraphs", {
  14085. get: function () {
  14086. if (!this.m_paragraphs) {
  14087. this.m_paragraphs=new OneNote.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  14088. }
  14089. return this.m_paragraphs;
  14090. },
  14091. enumerable: true,
  14092. configurable: true
  14093. });
  14094. Object.defineProperty(Paragraph.prototype, "parentParagraph", {
  14095. get: function () {
  14096. if (!this.m_parentParagraph) {
  14097. this.m_parentParagraph=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "ParentParagraph", false, false));
  14098. }
  14099. return this.m_parentParagraph;
  14100. },
  14101. enumerable: true,
  14102. configurable: true
  14103. });
  14104. Object.defineProperty(Paragraph.prototype, "parentParagraphOrNull", {
  14105. get: function () {
  14106. if (!this.m_parentParagraphOrNull) {
  14107. this.m_parentParagraphOrNull=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "ParentParagraphOrNull", false, false));
  14108. }
  14109. return this.m_parentParagraphOrNull;
  14110. },
  14111. enumerable: true,
  14112. configurable: true
  14113. });
  14114. Object.defineProperty(Paragraph.prototype, "parentTableCell", {
  14115. get: function () {
  14116. if (!this.m_parentTableCell) {
  14117. this.m_parentTableCell=new OneNote.TableCell(this.context, _createPropertyObjectPath(this.context, this, "ParentTableCell", false, false));
  14118. }
  14119. return this.m_parentTableCell;
  14120. },
  14121. enumerable: true,
  14122. configurable: true
  14123. });
  14124. Object.defineProperty(Paragraph.prototype, "parentTableCellOrNull", {
  14125. get: function () {
  14126. if (!this.m_parentTableCellOrNull) {
  14127. this.m_parentTableCellOrNull=new OneNote.TableCell(this.context, _createPropertyObjectPath(this.context, this, "ParentTableCellOrNull", false, false));
  14128. }
  14129. return this.m_parentTableCellOrNull;
  14130. },
  14131. enumerable: true,
  14132. configurable: true
  14133. });
  14134. Object.defineProperty(Paragraph.prototype, "richText", {
  14135. get: function () {
  14136. if (!this.m_richText) {
  14137. this.m_richText=new OneNote.RichText(this.context, _createPropertyObjectPath(this.context, this, "RichText", false, false));
  14138. }
  14139. return this.m_richText;
  14140. },
  14141. enumerable: true,
  14142. configurable: true
  14143. });
  14144. Object.defineProperty(Paragraph.prototype, "table", {
  14145. get: function () {
  14146. if (!this.m_table) {
  14147. this.m_table=new OneNote.Table(this.context, _createPropertyObjectPath(this.context, this, "Table", false, false));
  14148. }
  14149. return this.m_table;
  14150. },
  14151. enumerable: true,
  14152. configurable: true
  14153. });
  14154. Object.defineProperty(Paragraph.prototype, "id", {
  14155. get: function () {
  14156. _throwIfNotLoaded("id", this.m_id, "Paragraph", this._isNull);
  14157. return this.m_id;
  14158. },
  14159. enumerable: true,
  14160. configurable: true
  14161. });
  14162. Object.defineProperty(Paragraph.prototype, "type", {
  14163. get: function () {
  14164. _throwIfNotLoaded("type", this.m_type, "Paragraph", this._isNull);
  14165. return this.m_type;
  14166. },
  14167. enumerable: true,
  14168. configurable: true
  14169. });
  14170. Object.defineProperty(Paragraph.prototype, "_ReferenceId", {
  14171. get: function () {
  14172. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Paragraph", this._isNull);
  14173. return this.m__ReferenceId;
  14174. },
  14175. enumerable: true,
  14176. configurable: true
  14177. });
  14178. Paragraph.prototype.delete=function () {
  14179. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, []);
  14180. };
  14181. Paragraph.prototype.insertHtmlAsSibling=function (insertLocation, html) {
  14182. _createMethodAction(this.context, this, "InsertHtmlAsSibling", OfficeExtension.OperationType.Default, [insertLocation, html]);
  14183. };
  14184. Paragraph.prototype.insertImageAsSibling=function (insertLocation, base64EncodedImage, width, height) {
  14185. return new OneNote.Image(this.context, _createMethodObjectPath(this.context, this, "InsertImageAsSibling", OfficeExtension.OperationType.Default, [insertLocation, base64EncodedImage, width, height], false, true, null));
  14186. };
  14187. Paragraph.prototype.insertRichTextAsSibling=function (insertLocation, paragraphText) {
  14188. return new OneNote.RichText(this.context, _createMethodObjectPath(this.context, this, "InsertRichTextAsSibling", OfficeExtension.OperationType.Default, [insertLocation, paragraphText], false, true, null));
  14189. };
  14190. Paragraph.prototype.insertTableAsSibling=function (insertLocation, rowCount, columnCount, values) {
  14191. return new OneNote.Table(this.context, _createMethodObjectPath(this.context, this, "InsertTableAsSibling", OfficeExtension.OperationType.Default, [insertLocation, rowCount, columnCount, values], false, true, null));
  14192. };
  14193. Paragraph.prototype._KeepReference=function () {
  14194. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14195. };
  14196. Paragraph.prototype._handleResult=function (value) {
  14197. _super.prototype._handleResult.call(this, value);
  14198. if (_isNullOrUndefined(value))
  14199. return;
  14200. var obj=value;
  14201. _fixObjectPathIfNecessary(this, obj);
  14202. if (!_isUndefined(obj["Id"])) {
  14203. this.m_id=obj["Id"];
  14204. }
  14205. if (!_isUndefined(obj["Type"])) {
  14206. this.m_type=obj["Type"];
  14207. }
  14208. if (!_isUndefined(obj["_ReferenceId"])) {
  14209. this.m__ReferenceId=obj["_ReferenceId"];
  14210. }
  14211. _handleNavigationPropertyResults(this, obj, ["image", "Image", "inkWords", "InkWords", "outline", "Outline", "paragraphs", "Paragraphs", "parentParagraph", "ParentParagraph", "parentParagraphOrNull", "ParentParagraphOrNull", "parentTableCell", "ParentTableCell", "parentTableCellOrNull", "ParentTableCellOrNull", "richText", "RichText", "table", "Table"]);
  14212. };
  14213. Paragraph.prototype.load=function (option) {
  14214. _load(this, option);
  14215. return this;
  14216. };
  14217. Paragraph.prototype._handleIdResult=function (value) {
  14218. _super.prototype._handleIdResult.call(this, value);
  14219. if (_isNullOrUndefined(value)) {
  14220. return;
  14221. }
  14222. if (!_isUndefined(value["_ReferenceId"])) {
  14223. this.m__ReferenceId=value["_ReferenceId"];
  14224. }
  14225. if (!_isUndefined(value["Id"])) {
  14226. this.m_id=value["Id"];
  14227. }
  14228. };
  14229. Paragraph.prototype.track=function () {
  14230. this.context.trackedObjects.add(this);
  14231. return this;
  14232. };
  14233. Paragraph.prototype.untrack=function () {
  14234. this.context.trackedObjects.remove(this);
  14235. return this;
  14236. };
  14237. Paragraph.prototype.toJSON=function () {
  14238. return {
  14239. "id": this.m_id,
  14240. "type": this.m_type
  14241. };
  14242. };
  14243. return Paragraph;
  14244. }(OfficeExtension.ClientObject));
  14245. OneNote.Paragraph=Paragraph;
  14246. var ParagraphCollection=(function (_super) {
  14247. __extends(ParagraphCollection, _super);
  14248. function ParagraphCollection() {
  14249. _super.apply(this, arguments);
  14250. }
  14251. Object.defineProperty(ParagraphCollection.prototype, "items", {
  14252. get: function () {
  14253. _throwIfNotLoaded("items", this.m__items, "ParagraphCollection", this._isNull);
  14254. return this.m__items;
  14255. },
  14256. enumerable: true,
  14257. configurable: true
  14258. });
  14259. Object.defineProperty(ParagraphCollection.prototype, "count", {
  14260. get: function () {
  14261. _throwIfNotLoaded("count", this.m_count, "ParagraphCollection", this._isNull);
  14262. return this.m_count;
  14263. },
  14264. enumerable: true,
  14265. configurable: true
  14266. });
  14267. Object.defineProperty(ParagraphCollection.prototype, "_ReferenceId", {
  14268. get: function () {
  14269. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ParagraphCollection", this._isNull);
  14270. return this.m__ReferenceId;
  14271. },
  14272. enumerable: true,
  14273. configurable: true
  14274. });
  14275. ParagraphCollection.prototype.getItem=function (index) {
  14276. return new OneNote.Paragraph(this.context, _createIndexerObjectPath(this.context, this, [index]));
  14277. };
  14278. ParagraphCollection.prototype.getItemAt=function (index) {
  14279. return new OneNote.Paragraph(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  14280. };
  14281. ParagraphCollection.prototype._KeepReference=function () {
  14282. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14283. };
  14284. ParagraphCollection.prototype._handleResult=function (value) {
  14285. _super.prototype._handleResult.call(this, value);
  14286. if (_isNullOrUndefined(value))
  14287. return;
  14288. var obj=value;
  14289. _fixObjectPathIfNecessary(this, obj);
  14290. if (!_isUndefined(obj["Count"])) {
  14291. this.m_count=obj["Count"];
  14292. }
  14293. if (!_isUndefined(obj["_ReferenceId"])) {
  14294. this.m__ReferenceId=obj["_ReferenceId"];
  14295. }
  14296. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  14297. this.m__items=[];
  14298. var _data=obj[OfficeExtension.Constants.items];
  14299. for (var i=0; i < _data.length; i++) {
  14300. var _item=new OneNote.Paragraph(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  14301. _item._handleResult(_data[i]);
  14302. this.m__items.push(_item);
  14303. }
  14304. }
  14305. };
  14306. ParagraphCollection.prototype.load=function (option) {
  14307. _load(this, option);
  14308. return this;
  14309. };
  14310. ParagraphCollection.prototype._handleIdResult=function (value) {
  14311. _super.prototype._handleIdResult.call(this, value);
  14312. if (_isNullOrUndefined(value)) {
  14313. return;
  14314. }
  14315. if (!_isUndefined(value["_ReferenceId"])) {
  14316. this.m__ReferenceId=value["_ReferenceId"];
  14317. }
  14318. };
  14319. ParagraphCollection.prototype.track=function () {
  14320. this.context.trackedObjects.add(this);
  14321. return this;
  14322. };
  14323. ParagraphCollection.prototype.untrack=function () {
  14324. this.context.trackedObjects.remove(this);
  14325. return this;
  14326. };
  14327. ParagraphCollection.prototype.toJSON=function () {
  14328. return {
  14329. "count": this.m_count
  14330. };
  14331. };
  14332. return ParagraphCollection;
  14333. }(OfficeExtension.ClientObject));
  14334. OneNote.ParagraphCollection=ParagraphCollection;
  14335. var RichText=(function (_super) {
  14336. __extends(RichText, _super);
  14337. function RichText() {
  14338. _super.apply(this, arguments);
  14339. }
  14340. Object.defineProperty(RichText.prototype, "paragraph", {
  14341. get: function () {
  14342. if (!this.m_paragraph) {
  14343. this.m_paragraph=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  14344. }
  14345. return this.m_paragraph;
  14346. },
  14347. enumerable: true,
  14348. configurable: true
  14349. });
  14350. Object.defineProperty(RichText.prototype, "id", {
  14351. get: function () {
  14352. _throwIfNotLoaded("id", this.m_id, "RichText", this._isNull);
  14353. return this.m_id;
  14354. },
  14355. enumerable: true,
  14356. configurable: true
  14357. });
  14358. Object.defineProperty(RichText.prototype, "languageId", {
  14359. get: function () {
  14360. _throwIfNotLoaded("languageId", this.m_languageId, "RichText", this._isNull);
  14361. return this.m_languageId;
  14362. },
  14363. enumerable: true,
  14364. configurable: true
  14365. });
  14366. Object.defineProperty(RichText.prototype, "text", {
  14367. get: function () {
  14368. _throwIfNotLoaded("text", this.m_text, "RichText", this._isNull);
  14369. return this.m_text;
  14370. },
  14371. enumerable: true,
  14372. configurable: true
  14373. });
  14374. Object.defineProperty(RichText.prototype, "_ReferenceId", {
  14375. get: function () {
  14376. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "RichText", this._isNull);
  14377. return this.m__ReferenceId;
  14378. },
  14379. enumerable: true,
  14380. configurable: true
  14381. });
  14382. RichText.prototype.getHtml=function () {
  14383. var action=_createMethodAction(this.context, this, "GetHtml", OfficeExtension.OperationType.Read, []);
  14384. var ret=new OfficeExtension.ClientResult();
  14385. _addActionResultHandler(this, action, ret);
  14386. return ret;
  14387. };
  14388. RichText.prototype._KeepReference=function () {
  14389. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14390. };
  14391. RichText.prototype._handleResult=function (value) {
  14392. _super.prototype._handleResult.call(this, value);
  14393. if (_isNullOrUndefined(value))
  14394. return;
  14395. var obj=value;
  14396. _fixObjectPathIfNecessary(this, obj);
  14397. if (!_isUndefined(obj["Id"])) {
  14398. this.m_id=obj["Id"];
  14399. }
  14400. if (!_isUndefined(obj["LanguageId"])) {
  14401. this.m_languageId=obj["LanguageId"];
  14402. }
  14403. if (!_isUndefined(obj["Text"])) {
  14404. this.m_text=obj["Text"];
  14405. }
  14406. if (!_isUndefined(obj["_ReferenceId"])) {
  14407. this.m__ReferenceId=obj["_ReferenceId"];
  14408. }
  14409. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph"]);
  14410. };
  14411. RichText.prototype.load=function (option) {
  14412. _load(this, option);
  14413. return this;
  14414. };
  14415. RichText.prototype._handleIdResult=function (value) {
  14416. _super.prototype._handleIdResult.call(this, value);
  14417. if (_isNullOrUndefined(value)) {
  14418. return;
  14419. }
  14420. if (!_isUndefined(value["_ReferenceId"])) {
  14421. this.m__ReferenceId=value["_ReferenceId"];
  14422. }
  14423. if (!_isUndefined(value["Id"])) {
  14424. this.m_id=value["Id"];
  14425. }
  14426. };
  14427. RichText.prototype.track=function () {
  14428. this.context.trackedObjects.add(this);
  14429. return this;
  14430. };
  14431. RichText.prototype.untrack=function () {
  14432. this.context.trackedObjects.remove(this);
  14433. return this;
  14434. };
  14435. RichText.prototype.toJSON=function () {
  14436. return {
  14437. "id": this.m_id,
  14438. "languageId": this.m_languageId,
  14439. "text": this.m_text
  14440. };
  14441. };
  14442. return RichText;
  14443. }(OfficeExtension.ClientObject));
  14444. OneNote.RichText=RichText;
  14445. var Image=(function (_super) {
  14446. __extends(Image, _super);
  14447. function Image() {
  14448. _super.apply(this, arguments);
  14449. }
  14450. Object.defineProperty(Image.prototype, "pageContent", {
  14451. get: function () {
  14452. if (!this.m_pageContent) {
  14453. this.m_pageContent=new OneNote.PageContent(this.context, _createPropertyObjectPath(this.context, this, "PageContent", false, false));
  14454. }
  14455. return this.m_pageContent;
  14456. },
  14457. enumerable: true,
  14458. configurable: true
  14459. });
  14460. Object.defineProperty(Image.prototype, "paragraph", {
  14461. get: function () {
  14462. if (!this.m_paragraph) {
  14463. this.m_paragraph=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  14464. }
  14465. return this.m_paragraph;
  14466. },
  14467. enumerable: true,
  14468. configurable: true
  14469. });
  14470. Object.defineProperty(Image.prototype, "description", {
  14471. get: function () {
  14472. _throwIfNotLoaded("description", this.m_description, "Image", this._isNull);
  14473. return this.m_description;
  14474. },
  14475. set: function (value) {
  14476. this.m_description=value;
  14477. _createSetPropertyAction(this.context, this, "Description", value);
  14478. },
  14479. enumerable: true,
  14480. configurable: true
  14481. });
  14482. Object.defineProperty(Image.prototype, "height", {
  14483. get: function () {
  14484. _throwIfNotLoaded("height", this.m_height, "Image", this._isNull);
  14485. return this.m_height;
  14486. },
  14487. set: function (value) {
  14488. this.m_height=value;
  14489. _createSetPropertyAction(this.context, this, "Height", value);
  14490. },
  14491. enumerable: true,
  14492. configurable: true
  14493. });
  14494. Object.defineProperty(Image.prototype, "hyperlink", {
  14495. get: function () {
  14496. _throwIfNotLoaded("hyperlink", this.m_hyperlink, "Image", this._isNull);
  14497. return this.m_hyperlink;
  14498. },
  14499. set: function (value) {
  14500. this.m_hyperlink=value;
  14501. _createSetPropertyAction(this.context, this, "Hyperlink", value);
  14502. },
  14503. enumerable: true,
  14504. configurable: true
  14505. });
  14506. Object.defineProperty(Image.prototype, "id", {
  14507. get: function () {
  14508. _throwIfNotLoaded("id", this.m_id, "Image", this._isNull);
  14509. return this.m_id;
  14510. },
  14511. enumerable: true,
  14512. configurable: true
  14513. });
  14514. Object.defineProperty(Image.prototype, "ocrData", {
  14515. get: function () {
  14516. _throwIfNotLoaded("ocrData", this.m_ocrData, "Image", this._isNull);
  14517. return this.m_ocrData;
  14518. },
  14519. enumerable: true,
  14520. configurable: true
  14521. });
  14522. Object.defineProperty(Image.prototype, "width", {
  14523. get: function () {
  14524. _throwIfNotLoaded("width", this.m_width, "Image", this._isNull);
  14525. return this.m_width;
  14526. },
  14527. set: function (value) {
  14528. this.m_width=value;
  14529. _createSetPropertyAction(this.context, this, "Width", value);
  14530. },
  14531. enumerable: true,
  14532. configurable: true
  14533. });
  14534. Object.defineProperty(Image.prototype, "_ReferenceId", {
  14535. get: function () {
  14536. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Image", this._isNull);
  14537. return this.m__ReferenceId;
  14538. },
  14539. enumerable: true,
  14540. configurable: true
  14541. });
  14542. Image.prototype.getBase64Image=function () {
  14543. var action=_createMethodAction(this.context, this, "GetBase64Image", OfficeExtension.OperationType.Read, []);
  14544. var ret=new OfficeExtension.ClientResult();
  14545. _addActionResultHandler(this, action, ret);
  14546. return ret;
  14547. };
  14548. Image.prototype._KeepReference=function () {
  14549. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14550. };
  14551. Image.prototype._handleResult=function (value) {
  14552. _super.prototype._handleResult.call(this, value);
  14553. if (_isNullOrUndefined(value))
  14554. return;
  14555. var obj=value;
  14556. _fixObjectPathIfNecessary(this, obj);
  14557. if (!_isUndefined(obj["Description"])) {
  14558. this.m_description=obj["Description"];
  14559. }
  14560. if (!_isUndefined(obj["Height"])) {
  14561. this.m_height=obj["Height"];
  14562. }
  14563. if (!_isUndefined(obj["Hyperlink"])) {
  14564. this.m_hyperlink=obj["Hyperlink"];
  14565. }
  14566. if (!_isUndefined(obj["Id"])) {
  14567. this.m_id=obj["Id"];
  14568. }
  14569. if (!_isUndefined(obj["OcrData"])) {
  14570. this.m_ocrData=obj["OcrData"];
  14571. }
  14572. if (!_isUndefined(obj["Width"])) {
  14573. this.m_width=obj["Width"];
  14574. }
  14575. if (!_isUndefined(obj["_ReferenceId"])) {
  14576. this.m__ReferenceId=obj["_ReferenceId"];
  14577. }
  14578. _handleNavigationPropertyResults(this, obj, ["pageContent", "PageContent", "paragraph", "Paragraph"]);
  14579. };
  14580. Image.prototype.load=function (option) {
  14581. _load(this, option);
  14582. return this;
  14583. };
  14584. Image.prototype._handleIdResult=function (value) {
  14585. _super.prototype._handleIdResult.call(this, value);
  14586. if (_isNullOrUndefined(value)) {
  14587. return;
  14588. }
  14589. if (!_isUndefined(value["_ReferenceId"])) {
  14590. this.m__ReferenceId=value["_ReferenceId"];
  14591. }
  14592. if (!_isUndefined(value["Id"])) {
  14593. this.m_id=value["Id"];
  14594. }
  14595. };
  14596. Image.prototype.track=function () {
  14597. this.context.trackedObjects.add(this);
  14598. return this;
  14599. };
  14600. Image.prototype.untrack=function () {
  14601. this.context.trackedObjects.remove(this);
  14602. return this;
  14603. };
  14604. Image.prototype.toJSON=function () {
  14605. return {
  14606. "description": this.m_description,
  14607. "height": this.m_height,
  14608. "hyperlink": this.m_hyperlink,
  14609. "id": this.m_id,
  14610. "ocrData": this.m_ocrData,
  14611. "width": this.m_width
  14612. };
  14613. };
  14614. return Image;
  14615. }(OfficeExtension.ClientObject));
  14616. OneNote.Image=Image;
  14617. var Table=(function (_super) {
  14618. __extends(Table, _super);
  14619. function Table() {
  14620. _super.apply(this, arguments);
  14621. }
  14622. Object.defineProperty(Table.prototype, "paragraph", {
  14623. get: function () {
  14624. if (!this.m_paragraph) {
  14625. this.m_paragraph=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  14626. }
  14627. return this.m_paragraph;
  14628. },
  14629. enumerable: true,
  14630. configurable: true
  14631. });
  14632. Object.defineProperty(Table.prototype, "rows", {
  14633. get: function () {
  14634. if (!this.m_rows) {
  14635. this.m_rows=new OneNote.TableRowCollection(this.context, _createPropertyObjectPath(this.context, this, "Rows", true, false));
  14636. }
  14637. return this.m_rows;
  14638. },
  14639. enumerable: true,
  14640. configurable: true
  14641. });
  14642. Object.defineProperty(Table.prototype, "borderVisible", {
  14643. get: function () {
  14644. _throwIfNotLoaded("borderVisible", this.m_borderVisible, "Table", this._isNull);
  14645. return this.m_borderVisible;
  14646. },
  14647. set: function (value) {
  14648. this.m_borderVisible=value;
  14649. _createSetPropertyAction(this.context, this, "BorderVisible", value);
  14650. },
  14651. enumerable: true,
  14652. configurable: true
  14653. });
  14654. Object.defineProperty(Table.prototype, "columnCount", {
  14655. get: function () {
  14656. _throwIfNotLoaded("columnCount", this.m_columnCount, "Table", this._isNull);
  14657. return this.m_columnCount;
  14658. },
  14659. enumerable: true,
  14660. configurable: true
  14661. });
  14662. Object.defineProperty(Table.prototype, "id", {
  14663. get: function () {
  14664. _throwIfNotLoaded("id", this.m_id, "Table", this._isNull);
  14665. return this.m_id;
  14666. },
  14667. enumerable: true,
  14668. configurable: true
  14669. });
  14670. Object.defineProperty(Table.prototype, "rowCount", {
  14671. get: function () {
  14672. _throwIfNotLoaded("rowCount", this.m_rowCount, "Table", this._isNull);
  14673. return this.m_rowCount;
  14674. },
  14675. enumerable: true,
  14676. configurable: true
  14677. });
  14678. Object.defineProperty(Table.prototype, "_ReferenceId", {
  14679. get: function () {
  14680. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Table", this._isNull);
  14681. return this.m__ReferenceId;
  14682. },
  14683. enumerable: true,
  14684. configurable: true
  14685. });
  14686. Table.prototype.appendColumn=function (values) {
  14687. _createMethodAction(this.context, this, "AppendColumn", OfficeExtension.OperationType.Default, [values]);
  14688. };
  14689. Table.prototype.appendRow=function (values) {
  14690. return new OneNote.TableRow(this.context, _createMethodObjectPath(this.context, this, "AppendRow", OfficeExtension.OperationType.Default, [values], false, true, null));
  14691. };
  14692. Table.prototype.clear=function () {
  14693. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  14694. };
  14695. Table.prototype.getCell=function (rowIndex, cellIndex) {
  14696. return new OneNote.TableCell(this.context, _createMethodObjectPath(this.context, this, "GetCell", OfficeExtension.OperationType.Read, [rowIndex, cellIndex], false, false, null));
  14697. };
  14698. Table.prototype.insertColumn=function (index, values) {
  14699. _createMethodAction(this.context, this, "InsertColumn", OfficeExtension.OperationType.Default, [index, values]);
  14700. };
  14701. Table.prototype.insertRow=function (index, values) {
  14702. return new OneNote.TableRow(this.context, _createMethodObjectPath(this.context, this, "InsertRow", OfficeExtension.OperationType.Default, [index, values], false, true, null));
  14703. };
  14704. Table.prototype.setShadingColor=function (colorCode) {
  14705. _createMethodAction(this.context, this, "SetShadingColor", OfficeExtension.OperationType.Default, [colorCode]);
  14706. };
  14707. Table.prototype._KeepReference=function () {
  14708. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14709. };
  14710. Table.prototype._handleResult=function (value) {
  14711. _super.prototype._handleResult.call(this, value);
  14712. if (_isNullOrUndefined(value))
  14713. return;
  14714. var obj=value;
  14715. _fixObjectPathIfNecessary(this, obj);
  14716. if (!_isUndefined(obj["BorderVisible"])) {
  14717. this.m_borderVisible=obj["BorderVisible"];
  14718. }
  14719. if (!_isUndefined(obj["ColumnCount"])) {
  14720. this.m_columnCount=obj["ColumnCount"];
  14721. }
  14722. if (!_isUndefined(obj["Id"])) {
  14723. this.m_id=obj["Id"];
  14724. }
  14725. if (!_isUndefined(obj["RowCount"])) {
  14726. this.m_rowCount=obj["RowCount"];
  14727. }
  14728. if (!_isUndefined(obj["_ReferenceId"])) {
  14729. this.m__ReferenceId=obj["_ReferenceId"];
  14730. }
  14731. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph", "rows", "Rows"]);
  14732. };
  14733. Table.prototype.load=function (option) {
  14734. _load(this, option);
  14735. return this;
  14736. };
  14737. Table.prototype._handleIdResult=function (value) {
  14738. _super.prototype._handleIdResult.call(this, value);
  14739. if (_isNullOrUndefined(value)) {
  14740. return;
  14741. }
  14742. if (!_isUndefined(value["_ReferenceId"])) {
  14743. this.m__ReferenceId=value["_ReferenceId"];
  14744. }
  14745. if (!_isUndefined(value["Id"])) {
  14746. this.m_id=value["Id"];
  14747. }
  14748. };
  14749. Table.prototype.track=function () {
  14750. this.context.trackedObjects.add(this);
  14751. return this;
  14752. };
  14753. Table.prototype.untrack=function () {
  14754. this.context.trackedObjects.remove(this);
  14755. return this;
  14756. };
  14757. Table.prototype.toJSON=function () {
  14758. return {
  14759. "borderVisible": this.m_borderVisible,
  14760. "columnCount": this.m_columnCount,
  14761. "id": this.m_id,
  14762. "rowCount": this.m_rowCount
  14763. };
  14764. };
  14765. return Table;
  14766. }(OfficeExtension.ClientObject));
  14767. OneNote.Table=Table;
  14768. var TableRow=(function (_super) {
  14769. __extends(TableRow, _super);
  14770. function TableRow() {
  14771. _super.apply(this, arguments);
  14772. }
  14773. Object.defineProperty(TableRow.prototype, "cells", {
  14774. get: function () {
  14775. if (!this.m_cells) {
  14776. this.m_cells=new OneNote.TableCellCollection(this.context, _createPropertyObjectPath(this.context, this, "Cells", true, false));
  14777. }
  14778. return this.m_cells;
  14779. },
  14780. enumerable: true,
  14781. configurable: true
  14782. });
  14783. Object.defineProperty(TableRow.prototype, "parentTable", {
  14784. get: function () {
  14785. if (!this.m_parentTable) {
  14786. this.m_parentTable=new OneNote.Table(this.context, _createPropertyObjectPath(this.context, this, "ParentTable", false, false));
  14787. }
  14788. return this.m_parentTable;
  14789. },
  14790. enumerable: true,
  14791. configurable: true
  14792. });
  14793. Object.defineProperty(TableRow.prototype, "cellCount", {
  14794. get: function () {
  14795. _throwIfNotLoaded("cellCount", this.m_cellCount, "TableRow", this._isNull);
  14796. return this.m_cellCount;
  14797. },
  14798. enumerable: true,
  14799. configurable: true
  14800. });
  14801. Object.defineProperty(TableRow.prototype, "id", {
  14802. get: function () {
  14803. _throwIfNotLoaded("id", this.m_id, "TableRow", this._isNull);
  14804. return this.m_id;
  14805. },
  14806. enumerable: true,
  14807. configurable: true
  14808. });
  14809. Object.defineProperty(TableRow.prototype, "rowIndex", {
  14810. get: function () {
  14811. _throwIfNotLoaded("rowIndex", this.m_rowIndex, "TableRow", this._isNull);
  14812. return this.m_rowIndex;
  14813. },
  14814. enumerable: true,
  14815. configurable: true
  14816. });
  14817. Object.defineProperty(TableRow.prototype, "_ReferenceId", {
  14818. get: function () {
  14819. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "TableRow", this._isNull);
  14820. return this.m__ReferenceId;
  14821. },
  14822. enumerable: true,
  14823. configurable: true
  14824. });
  14825. TableRow.prototype.clear=function () {
  14826. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  14827. };
  14828. TableRow.prototype.insertRowAsSibling=function (insertLocation, values) {
  14829. return new OneNote.TableRow(this.context, _createMethodObjectPath(this.context, this, "InsertRowAsSibling", OfficeExtension.OperationType.Default, [insertLocation, values], false, true, null));
  14830. };
  14831. TableRow.prototype.setShadingColor=function (colorCode) {
  14832. _createMethodAction(this.context, this, "SetShadingColor", OfficeExtension.OperationType.Default, [colorCode]);
  14833. };
  14834. TableRow.prototype._KeepReference=function () {
  14835. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14836. };
  14837. TableRow.prototype._handleResult=function (value) {
  14838. _super.prototype._handleResult.call(this, value);
  14839. if (_isNullOrUndefined(value))
  14840. return;
  14841. var obj=value;
  14842. _fixObjectPathIfNecessary(this, obj);
  14843. if (!_isUndefined(obj["CellCount"])) {
  14844. this.m_cellCount=obj["CellCount"];
  14845. }
  14846. if (!_isUndefined(obj["Id"])) {
  14847. this.m_id=obj["Id"];
  14848. }
  14849. if (!_isUndefined(obj["RowIndex"])) {
  14850. this.m_rowIndex=obj["RowIndex"];
  14851. }
  14852. if (!_isUndefined(obj["_ReferenceId"])) {
  14853. this.m__ReferenceId=obj["_ReferenceId"];
  14854. }
  14855. _handleNavigationPropertyResults(this, obj, ["cells", "Cells", "parentTable", "ParentTable"]);
  14856. };
  14857. TableRow.prototype.load=function (option) {
  14858. _load(this, option);
  14859. return this;
  14860. };
  14861. TableRow.prototype._handleIdResult=function (value) {
  14862. _super.prototype._handleIdResult.call(this, value);
  14863. if (_isNullOrUndefined(value)) {
  14864. return;
  14865. }
  14866. if (!_isUndefined(value["_ReferenceId"])) {
  14867. this.m__ReferenceId=value["_ReferenceId"];
  14868. }
  14869. if (!_isUndefined(value["Id"])) {
  14870. this.m_id=value["Id"];
  14871. }
  14872. };
  14873. TableRow.prototype.track=function () {
  14874. this.context.trackedObjects.add(this);
  14875. return this;
  14876. };
  14877. TableRow.prototype.untrack=function () {
  14878. this.context.trackedObjects.remove(this);
  14879. return this;
  14880. };
  14881. TableRow.prototype.toJSON=function () {
  14882. return {
  14883. "cellCount": this.m_cellCount,
  14884. "id": this.m_id,
  14885. "rowIndex": this.m_rowIndex
  14886. };
  14887. };
  14888. return TableRow;
  14889. }(OfficeExtension.ClientObject));
  14890. OneNote.TableRow=TableRow;
  14891. var TableRowCollection=(function (_super) {
  14892. __extends(TableRowCollection, _super);
  14893. function TableRowCollection() {
  14894. _super.apply(this, arguments);
  14895. }
  14896. Object.defineProperty(TableRowCollection.prototype, "items", {
  14897. get: function () {
  14898. _throwIfNotLoaded("items", this.m__items, "TableRowCollection", this._isNull);
  14899. return this.m__items;
  14900. },
  14901. enumerable: true,
  14902. configurable: true
  14903. });
  14904. Object.defineProperty(TableRowCollection.prototype, "count", {
  14905. get: function () {
  14906. _throwIfNotLoaded("count", this.m_count, "TableRowCollection", this._isNull);
  14907. return this.m_count;
  14908. },
  14909. enumerable: true,
  14910. configurable: true
  14911. });
  14912. Object.defineProperty(TableRowCollection.prototype, "_ReferenceId", {
  14913. get: function () {
  14914. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "TableRowCollection", this._isNull);
  14915. return this.m__ReferenceId;
  14916. },
  14917. enumerable: true,
  14918. configurable: true
  14919. });
  14920. TableRowCollection.prototype.getItem=function (index) {
  14921. return new OneNote.TableRow(this.context, _createIndexerObjectPath(this.context, this, [index]));
  14922. };
  14923. TableRowCollection.prototype.getItemAt=function (index) {
  14924. return new OneNote.TableRow(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  14925. };
  14926. TableRowCollection.prototype._KeepReference=function () {
  14927. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14928. };
  14929. TableRowCollection.prototype._handleResult=function (value) {
  14930. _super.prototype._handleResult.call(this, value);
  14931. if (_isNullOrUndefined(value))
  14932. return;
  14933. var obj=value;
  14934. _fixObjectPathIfNecessary(this, obj);
  14935. if (!_isUndefined(obj["Count"])) {
  14936. this.m_count=obj["Count"];
  14937. }
  14938. if (!_isUndefined(obj["_ReferenceId"])) {
  14939. this.m__ReferenceId=obj["_ReferenceId"];
  14940. }
  14941. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  14942. this.m__items=[];
  14943. var _data=obj[OfficeExtension.Constants.items];
  14944. for (var i=0; i < _data.length; i++) {
  14945. var _item=new OneNote.TableRow(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  14946. _item._handleResult(_data[i]);
  14947. this.m__items.push(_item);
  14948. }
  14949. }
  14950. };
  14951. TableRowCollection.prototype.load=function (option) {
  14952. _load(this, option);
  14953. return this;
  14954. };
  14955. TableRowCollection.prototype._handleIdResult=function (value) {
  14956. _super.prototype._handleIdResult.call(this, value);
  14957. if (_isNullOrUndefined(value)) {
  14958. return;
  14959. }
  14960. if (!_isUndefined(value["_ReferenceId"])) {
  14961. this.m__ReferenceId=value["_ReferenceId"];
  14962. }
  14963. };
  14964. TableRowCollection.prototype.track=function () {
  14965. this.context.trackedObjects.add(this);
  14966. return this;
  14967. };
  14968. TableRowCollection.prototype.untrack=function () {
  14969. this.context.trackedObjects.remove(this);
  14970. return this;
  14971. };
  14972. TableRowCollection.prototype.toJSON=function () {
  14973. return {
  14974. "count": this.m_count
  14975. };
  14976. };
  14977. return TableRowCollection;
  14978. }(OfficeExtension.ClientObject));
  14979. OneNote.TableRowCollection=TableRowCollection;
  14980. var TableCell=(function (_super) {
  14981. __extends(TableCell, _super);
  14982. function TableCell() {
  14983. _super.apply(this, arguments);
  14984. }
  14985. Object.defineProperty(TableCell.prototype, "paragraphs", {
  14986. get: function () {
  14987. if (!this.m_paragraphs) {
  14988. this.m_paragraphs=new OneNote.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  14989. }
  14990. return this.m_paragraphs;
  14991. },
  14992. enumerable: true,
  14993. configurable: true
  14994. });
  14995. Object.defineProperty(TableCell.prototype, "parentRow", {
  14996. get: function () {
  14997. if (!this.m_parentRow) {
  14998. this.m_parentRow=new OneNote.TableRow(this.context, _createPropertyObjectPath(this.context, this, "ParentRow", false, false));
  14999. }
  15000. return this.m_parentRow;
  15001. },
  15002. enumerable: true,
  15003. configurable: true
  15004. });
  15005. Object.defineProperty(TableCell.prototype, "cellIndex", {
  15006. get: function () {
  15007. _throwIfNotLoaded("cellIndex", this.m_cellIndex, "TableCell", this._isNull);
  15008. return this.m_cellIndex;
  15009. },
  15010. enumerable: true,
  15011. configurable: true
  15012. });
  15013. Object.defineProperty(TableCell.prototype, "id", {
  15014. get: function () {
  15015. _throwIfNotLoaded("id", this.m_id, "TableCell", this._isNull);
  15016. return this.m_id;
  15017. },
  15018. enumerable: true,
  15019. configurable: true
  15020. });
  15021. Object.defineProperty(TableCell.prototype, "rowIndex", {
  15022. get: function () {
  15023. _throwIfNotLoaded("rowIndex", this.m_rowIndex, "TableCell", this._isNull);
  15024. return this.m_rowIndex;
  15025. },
  15026. enumerable: true,
  15027. configurable: true
  15028. });
  15029. Object.defineProperty(TableCell.prototype, "shadingColor", {
  15030. get: function () {
  15031. _throwIfNotLoaded("shadingColor", this.m_shadingColor, "TableCell", this._isNull);
  15032. return this.m_shadingColor;
  15033. },
  15034. set: function (value) {
  15035. this.m_shadingColor=value;
  15036. _createSetPropertyAction(this.context, this, "ShadingColor", value);
  15037. },
  15038. enumerable: true,
  15039. configurable: true
  15040. });
  15041. Object.defineProperty(TableCell.prototype, "_ReferenceId", {
  15042. get: function () {
  15043. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "TableCell", this._isNull);
  15044. return this.m__ReferenceId;
  15045. },
  15046. enumerable: true,
  15047. configurable: true
  15048. });
  15049. TableCell.prototype.appendHtml=function (html) {
  15050. _createMethodAction(this.context, this, "AppendHtml", OfficeExtension.OperationType.Default, [html]);
  15051. };
  15052. TableCell.prototype.appendImage=function (base64EncodedImage, width, height) {
  15053. return new OneNote.Image(this.context, _createMethodObjectPath(this.context, this, "AppendImage", OfficeExtension.OperationType.Default, [base64EncodedImage, width, height], false, true, null));
  15054. };
  15055. TableCell.prototype.appendRichText=function (paragraphText) {
  15056. return new OneNote.RichText(this.context, _createMethodObjectPath(this.context, this, "AppendRichText", OfficeExtension.OperationType.Default, [paragraphText], false, true, null));
  15057. };
  15058. TableCell.prototype.appendTable=function (rowCount, columnCount, values) {
  15059. return new OneNote.Table(this.context, _createMethodObjectPath(this.context, this, "AppendTable", OfficeExtension.OperationType.Default, [rowCount, columnCount, values], false, true, null));
  15060. };
  15061. TableCell.prototype.clear=function () {
  15062. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  15063. };
  15064. TableCell.prototype._KeepReference=function () {
  15065. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  15066. };
  15067. TableCell.prototype._handleResult=function (value) {
  15068. _super.prototype._handleResult.call(this, value);
  15069. if (_isNullOrUndefined(value))
  15070. return;
  15071. var obj=value;
  15072. _fixObjectPathIfNecessary(this, obj);
  15073. if (!_isUndefined(obj["CellIndex"])) {
  15074. this.m_cellIndex=obj["CellIndex"];
  15075. }
  15076. if (!_isUndefined(obj["Id"])) {
  15077. this.m_id=obj["Id"];
  15078. }
  15079. if (!_isUndefined(obj["RowIndex"])) {
  15080. this.m_rowIndex=obj["RowIndex"];
  15081. }
  15082. if (!_isUndefined(obj["ShadingColor"])) {
  15083. this.m_shadingColor=obj["ShadingColor"];
  15084. }
  15085. if (!_isUndefined(obj["_ReferenceId"])) {
  15086. this.m__ReferenceId=obj["_ReferenceId"];
  15087. }
  15088. _handleNavigationPropertyResults(this, obj, ["paragraphs", "Paragraphs", "parentRow", "ParentRow"]);
  15089. };
  15090. TableCell.prototype.load=function (option) {
  15091. _load(this, option);
  15092. return this;
  15093. };
  15094. TableCell.prototype._handleIdResult=function (value) {
  15095. _super.prototype._handleIdResult.call(this, value);
  15096. if (_isNullOrUndefined(value)) {
  15097. return;
  15098. }
  15099. if (!_isUndefined(value["_ReferenceId"])) {
  15100. this.m__ReferenceId=value["_ReferenceId"];
  15101. }
  15102. if (!_isUndefined(value["Id"])) {
  15103. this.m_id=value["Id"];
  15104. }
  15105. };
  15106. TableCell.prototype.track=function () {
  15107. this.context.trackedObjects.add(this);
  15108. return this;
  15109. };
  15110. TableCell.prototype.untrack=function () {
  15111. this.context.trackedObjects.remove(this);
  15112. return this;
  15113. };
  15114. TableCell.prototype.toJSON=function () {
  15115. return {
  15116. "cellIndex": this.m_cellIndex,
  15117. "id": this.m_id,
  15118. "rowIndex": this.m_rowIndex,
  15119. "shadingColor": this.m_shadingColor
  15120. };
  15121. };
  15122. return TableCell;
  15123. }(OfficeExtension.ClientObject));
  15124. OneNote.TableCell=TableCell;
  15125. var TableCellCollection=(function (_super) {
  15126. __extends(TableCellCollection, _super);
  15127. function TableCellCollection() {
  15128. _super.apply(this, arguments);
  15129. }
  15130. Object.defineProperty(TableCellCollection.prototype, "items", {
  15131. get: function () {
  15132. _throwIfNotLoaded("items", this.m__items, "TableCellCollection", this._isNull);
  15133. return this.m__items;
  15134. },
  15135. enumerable: true,
  15136. configurable: true
  15137. });
  15138. Object.defineProperty(TableCellCollection.prototype, "count", {
  15139. get: function () {
  15140. _throwIfNotLoaded("count", this.m_count, "TableCellCollection", this._isNull);
  15141. return this.m_count;
  15142. },
  15143. enumerable: true,
  15144. configurable: true
  15145. });
  15146. Object.defineProperty(TableCellCollection.prototype, "_ReferenceId", {
  15147. get: function () {
  15148. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "TableCellCollection", this._isNull);
  15149. return this.m__ReferenceId;
  15150. },
  15151. enumerable: true,
  15152. configurable: true
  15153. });
  15154. TableCellCollection.prototype.getItem=function (index) {
  15155. return new OneNote.TableCell(this.context, _createIndexerObjectPath(this.context, this, [index]));
  15156. };
  15157. TableCellCollection.prototype.getItemAt=function (index) {
  15158. return new OneNote.TableCell(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  15159. };
  15160. TableCellCollection.prototype._KeepReference=function () {
  15161. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  15162. };
  15163. TableCellCollection.prototype._handleResult=function (value) {
  15164. _super.prototype._handleResult.call(this, value);
  15165. if (_isNullOrUndefined(value))
  15166. return;
  15167. var obj=value;
  15168. _fixObjectPathIfNecessary(this, obj);
  15169. if (!_isUndefined(obj["Count"])) {
  15170. this.m_count=obj["Count"];
  15171. }
  15172. if (!_isUndefined(obj["_ReferenceId"])) {
  15173. this.m__ReferenceId=obj["_ReferenceId"];
  15174. }
  15175. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  15176. this.m__items=[];
  15177. var _data=obj[OfficeExtension.Constants.items];
  15178. for (var i=0; i < _data.length; i++) {
  15179. var _item=new OneNote.TableCell(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  15180. _item._handleResult(_data[i]);
  15181. this.m__items.push(_item);
  15182. }
  15183. }
  15184. };
  15185. TableCellCollection.prototype.load=function (option) {
  15186. _load(this, option);
  15187. return this;
  15188. };
  15189. TableCellCollection.prototype._handleIdResult=function (value) {
  15190. _super.prototype._handleIdResult.call(this, value);
  15191. if (_isNullOrUndefined(value)) {
  15192. return;
  15193. }
  15194. if (!_isUndefined(value["_ReferenceId"])) {
  15195. this.m__ReferenceId=value["_ReferenceId"];
  15196. }
  15197. };
  15198. TableCellCollection.prototype.track=function () {
  15199. this.context.trackedObjects.add(this);
  15200. return this;
  15201. };
  15202. TableCellCollection.prototype.untrack=function () {
  15203. this.context.trackedObjects.remove(this);
  15204. return this;
  15205. };
  15206. TableCellCollection.prototype.toJSON=function () {
  15207. return {
  15208. "count": this.m_count
  15209. };
  15210. };
  15211. return TableCellCollection;
  15212. }(OfficeExtension.ClientObject));
  15213. OneNote.TableCellCollection=TableCellCollection;
  15214. var InsertLocation;
  15215. (function (InsertLocation) {
  15216. InsertLocation.before="Before";
  15217. InsertLocation.after="After";
  15218. })(InsertLocation=OneNote.InsertLocation || (OneNote.InsertLocation={}));
  15219. var Alignment;
  15220. (function (Alignment) {
  15221. Alignment.left="Left";
  15222. Alignment.centered="Centered";
  15223. Alignment.right="Right";
  15224. Alignment.justified="Justified";
  15225. })(Alignment=OneNote.Alignment || (OneNote.Alignment={}));
  15226. var Selected;
  15227. (function (Selected) {
  15228. Selected.notSelected="NotSelected";
  15229. Selected.partialSelected="PartialSelected";
  15230. Selected.selected="Selected";
  15231. })(Selected=OneNote.Selected || (OneNote.Selected={}));
  15232. var PageContentType;
  15233. (function (PageContentType) {
  15234. PageContentType.outline="Outline";
  15235. PageContentType.image="Image";
  15236. PageContentType.ink="Ink";
  15237. PageContentType.other="Other";
  15238. })(PageContentType=OneNote.PageContentType || (OneNote.PageContentType={}));
  15239. var ParagraphType;
  15240. (function (ParagraphType) {
  15241. ParagraphType.richText="RichText";
  15242. ParagraphType.image="Image";
  15243. ParagraphType.table="Table";
  15244. ParagraphType.ink="Ink";
  15245. ParagraphType.other="Other";
  15246. })(ParagraphType=OneNote.ParagraphType || (OneNote.ParagraphType={}));
  15247. var ErrorCodes;
  15248. (function (ErrorCodes) {
  15249. ErrorCodes.generalException="GeneralException";
  15250. })(ErrorCodes=OneNote.ErrorCodes || (OneNote.ErrorCodes={}));
  15251. })(OneNote || (OneNote={}));
  15252. var OneNote;
  15253. (function (OneNote) {
  15254. var RequestContext=(function (_super) {
  15255. __extends(RequestContext, _super);
  15256. function RequestContext(url) {
  15257. _super.call(this, url);
  15258. this.m_onenote=new OneNote.Application(this, OfficeExtension.ObjectPathFactory.createGlobalObjectObjectPath(this));
  15259. this._rootObject=this.m_onenote;
  15260. }
  15261. Object.defineProperty(RequestContext.prototype, "application", {
  15262. get: function () {
  15263. return this.m_onenote;
  15264. },
  15265. enumerable: true,
  15266. configurable: true
  15267. });
  15268. return RequestContext;
  15269. }(OfficeExtension.ClientRequestContext));
  15270. OneNote.RequestContext=RequestContext;
  15271. function run(arg1, arg2) {
  15272. return OfficeExtension.ClientRequestContext._runBatch("OneNote.run", arguments, function () { return new OneNote.RequestContext(); });
  15273. }
  15274. OneNote.run=run;
  15275. })(OneNote || (OneNote={}));