editor.js 541 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227
  1. this["wp"] = this["wp"] || {}; this["wp"]["editor"] =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 343);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 0:
  90. /***/ (function(module, exports) {
  91. (function() { module.exports = this["wp"]["element"]; }());
  92. /***/ }),
  93. /***/ 1:
  94. /***/ (function(module, exports) {
  95. (function() { module.exports = this["wp"]["i18n"]; }());
  96. /***/ }),
  97. /***/ 10:
  98. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99. "use strict";
  100. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
  101. function _defineProperty(obj, key, value) {
  102. if (key in obj) {
  103. Object.defineProperty(obj, key, {
  104. value: value,
  105. enumerable: true,
  106. configurable: true,
  107. writable: true
  108. });
  109. } else {
  110. obj[key] = value;
  111. }
  112. return obj;
  113. }
  114. /***/ }),
  115. /***/ 11:
  116. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  117. "use strict";
  118. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
  119. function _defineProperties(target, props) {
  120. for (var i = 0; i < props.length; i++) {
  121. var descriptor = props[i];
  122. descriptor.enumerable = descriptor.enumerable || false;
  123. descriptor.configurable = true;
  124. if ("value" in descriptor) descriptor.writable = true;
  125. Object.defineProperty(target, descriptor.key, descriptor);
  126. }
  127. }
  128. function _createClass(Constructor, protoProps, staticProps) {
  129. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  130. if (staticProps) _defineProperties(Constructor, staticProps);
  131. return Constructor;
  132. }
  133. /***/ }),
  134. /***/ 115:
  135. /***/ (function(module, exports, __webpack_require__) {
  136. "use strict";
  137. var __extends = (this && this.__extends) || (function () {
  138. var extendStatics = Object.setPrototypeOf ||
  139. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  140. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  141. return function (d, b) {
  142. extendStatics(d, b);
  143. function __() { this.constructor = d; }
  144. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  145. };
  146. })();
  147. var __assign = (this && this.__assign) || Object.assign || function(t) {
  148. for (var s, i = 1, n = arguments.length; i < n; i++) {
  149. s = arguments[i];
  150. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  151. t[p] = s[p];
  152. }
  153. return t;
  154. };
  155. var __rest = (this && this.__rest) || function (s, e) {
  156. var t = {};
  157. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  158. t[p] = s[p];
  159. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  160. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
  161. t[p[i]] = s[p[i]];
  162. return t;
  163. };
  164. exports.__esModule = true;
  165. var React = __webpack_require__(28);
  166. var PropTypes = __webpack_require__(33);
  167. var autosize = __webpack_require__(116);
  168. var _getLineHeight = __webpack_require__(117);
  169. var getLineHeight = _getLineHeight;
  170. var UPDATE = 'autosize:update';
  171. var DESTROY = 'autosize:destroy';
  172. var RESIZED = 'autosize:resized';
  173. /**
  174. * A light replacement for built-in textarea component
  175. * which automaticaly adjusts its height to match the content
  176. */
  177. var TextareaAutosize = /** @class */ (function (_super) {
  178. __extends(TextareaAutosize, _super);
  179. function TextareaAutosize() {
  180. var _this = _super !== null && _super.apply(this, arguments) || this;
  181. _this.state = {
  182. lineHeight: null
  183. };
  184. _this.dispatchEvent = function (EVENT_TYPE) {
  185. var event = document.createEvent('Event');
  186. event.initEvent(EVENT_TYPE, true, false);
  187. _this.textarea.dispatchEvent(event);
  188. };
  189. _this.updateLineHeight = function () {
  190. _this.setState({
  191. lineHeight: getLineHeight(_this.textarea)
  192. });
  193. };
  194. _this.onChange = function (e) {
  195. var onChange = _this.props.onChange;
  196. _this.currentValue = e.currentTarget.value;
  197. onChange && onChange(e);
  198. };
  199. _this.saveDOMNodeRef = function (ref) {
  200. var innerRef = _this.props.innerRef;
  201. if (innerRef) {
  202. innerRef(ref);
  203. }
  204. _this.textarea = ref;
  205. };
  206. _this.getLocals = function () {
  207. var _a = _this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef"]), lineHeight = _a.state.lineHeight, saveDOMNodeRef = _a.saveDOMNodeRef;
  208. var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
  209. return __assign({}, props, { saveDOMNodeRef: saveDOMNodeRef, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, onChange: _this.onChange });
  210. };
  211. return _this;
  212. }
  213. TextareaAutosize.prototype.componentDidMount = function () {
  214. var _this = this;
  215. var _a = this.props, onResize = _a.onResize, maxRows = _a.maxRows;
  216. if (typeof maxRows === 'number') {
  217. this.updateLineHeight();
  218. }
  219. /*
  220. the defer is needed to:
  221. - force "autosize" to activate the scrollbar when this.props.maxRows is passed
  222. - support StyledComponents (see #71)
  223. */
  224. setTimeout(function () { return autosize(_this.textarea); });
  225. if (onResize) {
  226. this.textarea.addEventListener(RESIZED, onResize);
  227. }
  228. };
  229. TextareaAutosize.prototype.componentWillUnmount = function () {
  230. var onResize = this.props.onResize;
  231. if (onResize) {
  232. this.textarea.removeEventListener(RESIZED, onResize);
  233. }
  234. this.dispatchEvent(DESTROY);
  235. };
  236. TextareaAutosize.prototype.render = function () {
  237. var _a = this.getLocals(), children = _a.children, saveDOMNodeRef = _a.saveDOMNodeRef, locals = __rest(_a, ["children", "saveDOMNodeRef"]);
  238. return (React.createElement("textarea", __assign({}, locals, { ref: saveDOMNodeRef }), children));
  239. };
  240. TextareaAutosize.prototype.componentDidUpdate = function (prevProps) {
  241. if (this.props.value !== this.currentValue || this.props.rows !== prevProps.rows) {
  242. this.dispatchEvent(UPDATE);
  243. }
  244. };
  245. TextareaAutosize.defaultProps = {
  246. rows: 1
  247. };
  248. TextareaAutosize.propTypes = {
  249. rows: PropTypes.number,
  250. maxRows: PropTypes.number,
  251. onResize: PropTypes.func,
  252. innerRef: PropTypes.func
  253. };
  254. return TextareaAutosize;
  255. }(React.Component));
  256. exports["default"] = TextareaAutosize;
  257. /***/ }),
  258. /***/ 116:
  259. /***/ (function(module, exports, __webpack_require__) {
  260. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  261. autosize 4.0.2
  262. license: MIT
  263. http://www.jacklmoore.com/autosize
  264. */
  265. (function (global, factory) {
  266. if (true) {
  267. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  268. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  269. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  270. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  271. } else { var mod; }
  272. })(this, function (module, exports) {
  273. 'use strict';
  274. var map = typeof Map === "function" ? new Map() : function () {
  275. var keys = [];
  276. var values = [];
  277. return {
  278. has: function has(key) {
  279. return keys.indexOf(key) > -1;
  280. },
  281. get: function get(key) {
  282. return values[keys.indexOf(key)];
  283. },
  284. set: function set(key, value) {
  285. if (keys.indexOf(key) === -1) {
  286. keys.push(key);
  287. values.push(value);
  288. }
  289. },
  290. delete: function _delete(key) {
  291. var index = keys.indexOf(key);
  292. if (index > -1) {
  293. keys.splice(index, 1);
  294. values.splice(index, 1);
  295. }
  296. }
  297. };
  298. }();
  299. var createEvent = function createEvent(name) {
  300. return new Event(name, { bubbles: true });
  301. };
  302. try {
  303. new Event('test');
  304. } catch (e) {
  305. // IE does not support `new Event()`
  306. createEvent = function createEvent(name) {
  307. var evt = document.createEvent('Event');
  308. evt.initEvent(name, true, false);
  309. return evt;
  310. };
  311. }
  312. function assign(ta) {
  313. if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
  314. var heightOffset = null;
  315. var clientWidth = null;
  316. var cachedHeight = null;
  317. function init() {
  318. var style = window.getComputedStyle(ta, null);
  319. if (style.resize === 'vertical') {
  320. ta.style.resize = 'none';
  321. } else if (style.resize === 'both') {
  322. ta.style.resize = 'horizontal';
  323. }
  324. if (style.boxSizing === 'content-box') {
  325. heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  326. } else {
  327. heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  328. }
  329. // Fix when a textarea is not on document body and heightOffset is Not a Number
  330. if (isNaN(heightOffset)) {
  331. heightOffset = 0;
  332. }
  333. update();
  334. }
  335. function changeOverflow(value) {
  336. {
  337. // Chrome/Safari-specific fix:
  338. // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  339. // made available by removing the scrollbar. The following forces the necessary text reflow.
  340. var width = ta.style.width;
  341. ta.style.width = '0px';
  342. // Force reflow:
  343. /* jshint ignore:start */
  344. ta.offsetWidth;
  345. /* jshint ignore:end */
  346. ta.style.width = width;
  347. }
  348. ta.style.overflowY = value;
  349. }
  350. function getParentOverflows(el) {
  351. var arr = [];
  352. while (el && el.parentNode && el.parentNode instanceof Element) {
  353. if (el.parentNode.scrollTop) {
  354. arr.push({
  355. node: el.parentNode,
  356. scrollTop: el.parentNode.scrollTop
  357. });
  358. }
  359. el = el.parentNode;
  360. }
  361. return arr;
  362. }
  363. function resize() {
  364. if (ta.scrollHeight === 0) {
  365. // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
  366. return;
  367. }
  368. var overflows = getParentOverflows(ta);
  369. var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
  370. ta.style.height = '';
  371. ta.style.height = ta.scrollHeight + heightOffset + 'px';
  372. // used to check if an update is actually necessary on window.resize
  373. clientWidth = ta.clientWidth;
  374. // prevents scroll-position jumping
  375. overflows.forEach(function (el) {
  376. el.node.scrollTop = el.scrollTop;
  377. });
  378. if (docTop) {
  379. document.documentElement.scrollTop = docTop;
  380. }
  381. }
  382. function update() {
  383. resize();
  384. var styleHeight = Math.round(parseFloat(ta.style.height));
  385. var computed = window.getComputedStyle(ta, null);
  386. // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
  387. var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
  388. // The actual height not matching the style height (set via the resize method) indicates that
  389. // the max-height has been exceeded, in which case the overflow should be allowed.
  390. if (actualHeight < styleHeight) {
  391. if (computed.overflowY === 'hidden') {
  392. changeOverflow('scroll');
  393. resize();
  394. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  395. }
  396. } else {
  397. // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
  398. if (computed.overflowY !== 'hidden') {
  399. changeOverflow('hidden');
  400. resize();
  401. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  402. }
  403. }
  404. if (cachedHeight !== actualHeight) {
  405. cachedHeight = actualHeight;
  406. var evt = createEvent('autosize:resized');
  407. try {
  408. ta.dispatchEvent(evt);
  409. } catch (err) {
  410. // Firefox will throw an error on dispatchEvent for a detached element
  411. // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
  412. }
  413. }
  414. }
  415. var pageResize = function pageResize() {
  416. if (ta.clientWidth !== clientWidth) {
  417. update();
  418. }
  419. };
  420. var destroy = function (style) {
  421. window.removeEventListener('resize', pageResize, false);
  422. ta.removeEventListener('input', update, false);
  423. ta.removeEventListener('keyup', update, false);
  424. ta.removeEventListener('autosize:destroy', destroy, false);
  425. ta.removeEventListener('autosize:update', update, false);
  426. Object.keys(style).forEach(function (key) {
  427. ta.style[key] = style[key];
  428. });
  429. map.delete(ta);
  430. }.bind(ta, {
  431. height: ta.style.height,
  432. resize: ta.style.resize,
  433. overflowY: ta.style.overflowY,
  434. overflowX: ta.style.overflowX,
  435. wordWrap: ta.style.wordWrap
  436. });
  437. ta.addEventListener('autosize:destroy', destroy, false);
  438. // IE9 does not fire onpropertychange or oninput for deletions,
  439. // so binding to onkeyup to catch most of those events.
  440. // There is no way that I know of to detect something like 'cut' in IE9.
  441. if ('onpropertychange' in ta && 'oninput' in ta) {
  442. ta.addEventListener('keyup', update, false);
  443. }
  444. window.addEventListener('resize', pageResize, false);
  445. ta.addEventListener('input', update, false);
  446. ta.addEventListener('autosize:update', update, false);
  447. ta.style.overflowX = 'hidden';
  448. ta.style.wordWrap = 'break-word';
  449. map.set(ta, {
  450. destroy: destroy,
  451. update: update
  452. });
  453. init();
  454. }
  455. function destroy(ta) {
  456. var methods = map.get(ta);
  457. if (methods) {
  458. methods.destroy();
  459. }
  460. }
  461. function update(ta) {
  462. var methods = map.get(ta);
  463. if (methods) {
  464. methods.update();
  465. }
  466. }
  467. var autosize = null;
  468. // Do nothing in Node.js environment and IE8 (or lower)
  469. if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
  470. autosize = function autosize(el) {
  471. return el;
  472. };
  473. autosize.destroy = function (el) {
  474. return el;
  475. };
  476. autosize.update = function (el) {
  477. return el;
  478. };
  479. } else {
  480. autosize = function autosize(el, options) {
  481. if (el) {
  482. Array.prototype.forEach.call(el.length ? el : [el], function (x) {
  483. return assign(x, options);
  484. });
  485. }
  486. return el;
  487. };
  488. autosize.destroy = function (el) {
  489. if (el) {
  490. Array.prototype.forEach.call(el.length ? el : [el], destroy);
  491. }
  492. return el;
  493. };
  494. autosize.update = function (el) {
  495. if (el) {
  496. Array.prototype.forEach.call(el.length ? el : [el], update);
  497. }
  498. return el;
  499. };
  500. }
  501. exports.default = autosize;
  502. module.exports = exports['default'];
  503. });
  504. /***/ }),
  505. /***/ 117:
  506. /***/ (function(module, exports, __webpack_require__) {
  507. // Load in dependencies
  508. var computedStyle = __webpack_require__(118);
  509. /**
  510. * Calculate the `line-height` of a given node
  511. * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
  512. * @returns {Number} `line-height` of the element in pixels
  513. */
  514. function lineHeight(node) {
  515. // Grab the line-height via style
  516. var lnHeightStr = computedStyle(node, 'line-height');
  517. var lnHeight = parseFloat(lnHeightStr, 10);
  518. // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
  519. if (lnHeightStr === lnHeight + '') {
  520. // Save the old lineHeight style and update the em unit to the element
  521. var _lnHeightStyle = node.style.lineHeight;
  522. node.style.lineHeight = lnHeightStr + 'em';
  523. // Calculate the em based height
  524. lnHeightStr = computedStyle(node, 'line-height');
  525. lnHeight = parseFloat(lnHeightStr, 10);
  526. // Revert the lineHeight style
  527. if (_lnHeightStyle) {
  528. node.style.lineHeight = _lnHeightStyle;
  529. } else {
  530. delete node.style.lineHeight;
  531. }
  532. }
  533. // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
  534. // DEV: `em` units are converted to `pt` in IE6
  535. // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
  536. if (lnHeightStr.indexOf('pt') !== -1) {
  537. lnHeight *= 4;
  538. lnHeight /= 3;
  539. // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
  540. } else if (lnHeightStr.indexOf('mm') !== -1) {
  541. lnHeight *= 96;
  542. lnHeight /= 25.4;
  543. // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
  544. } else if (lnHeightStr.indexOf('cm') !== -1) {
  545. lnHeight *= 96;
  546. lnHeight /= 2.54;
  547. // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
  548. } else if (lnHeightStr.indexOf('in') !== -1) {
  549. lnHeight *= 96;
  550. // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
  551. } else if (lnHeightStr.indexOf('pc') !== -1) {
  552. lnHeight *= 16;
  553. }
  554. // Continue our computation
  555. lnHeight = Math.round(lnHeight);
  556. // If the line-height is "normal", calculate by font-size
  557. if (lnHeightStr === 'normal') {
  558. // Create a temporary node
  559. var nodeName = node.nodeName;
  560. var _node = document.createElement(nodeName);
  561. _node.innerHTML = '&nbsp;';
  562. // If we have a text area, reset it to only 1 row
  563. // https://github.com/twolfson/line-height/issues/4
  564. if (nodeName.toUpperCase() === 'TEXTAREA') {
  565. _node.setAttribute('rows', '1');
  566. }
  567. // Set the font-size of the element
  568. var fontSizeStr = computedStyle(node, 'font-size');
  569. _node.style.fontSize = fontSizeStr;
  570. // Remove default padding/border which can affect offset height
  571. // https://github.com/twolfson/line-height/issues/4
  572. // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
  573. _node.style.padding = '0px';
  574. _node.style.border = '0px';
  575. // Append it to the body
  576. var body = document.body;
  577. body.appendChild(_node);
  578. // Assume the line height of the element is the height
  579. var height = _node.offsetHeight;
  580. lnHeight = height;
  581. // Remove our child from the DOM
  582. body.removeChild(_node);
  583. }
  584. // Return the calculated height
  585. return lnHeight;
  586. }
  587. // Export lineHeight
  588. module.exports = lineHeight;
  589. /***/ }),
  590. /***/ 118:
  591. /***/ (function(module, exports) {
  592. // This code has been refactored for 140 bytes
  593. // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
  594. var computedStyle = function (el, prop, getComputedStyle) {
  595. getComputedStyle = window.getComputedStyle;
  596. // In one fell swoop
  597. return (
  598. // If we have getComputedStyle
  599. getComputedStyle ?
  600. // Query it
  601. // TODO: From CSS-Query notes, we might need (node, null) for FF
  602. getComputedStyle(el) :
  603. // Otherwise, we are in IE and use currentStyle
  604. el.currentStyle
  605. )[
  606. // Switch to camelCase for CSSOM
  607. // DEV: Grabbed from jQuery
  608. // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
  609. // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
  610. prop.replace(/-(\w)/gi, function (word, letter) {
  611. return letter.toUpperCase();
  612. })
  613. ];
  614. };
  615. module.exports = computedStyle;
  616. /***/ }),
  617. /***/ 12:
  618. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  619. "use strict";
  620. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
  621. function _classCallCheck(instance, Constructor) {
  622. if (!(instance instanceof Constructor)) {
  623. throw new TypeError("Cannot call a class as a function");
  624. }
  625. }
  626. /***/ }),
  627. /***/ 13:
  628. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  629. "use strict";
  630. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
  631. /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
  632. /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
  633. function _possibleConstructorReturn(self, call) {
  634. if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) {
  635. return call;
  636. }
  637. return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self);
  638. }
  639. /***/ }),
  640. /***/ 14:
  641. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  642. "use strict";
  643. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
  644. function _getPrototypeOf(o) {
  645. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  646. return o.__proto__ || Object.getPrototypeOf(o);
  647. };
  648. return _getPrototypeOf(o);
  649. }
  650. /***/ }),
  651. /***/ 142:
  652. /***/ (function(module, exports) {
  653. (function() { module.exports = this["wp"]["notices"]; }());
  654. /***/ }),
  655. /***/ 15:
  656. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  657. "use strict";
  658. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
  659. function _setPrototypeOf(o, p) {
  660. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  661. o.__proto__ = p;
  662. return o;
  663. };
  664. return _setPrototypeOf(o, p);
  665. }
  666. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
  667. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; });
  668. function _inherits(subClass, superClass) {
  669. if (typeof superClass !== "function" && superClass !== null) {
  670. throw new TypeError("Super expression must either be null or a function");
  671. }
  672. subClass.prototype = Object.create(superClass && superClass.prototype, {
  673. constructor: {
  674. value: subClass,
  675. writable: true,
  676. configurable: true
  677. }
  678. });
  679. if (superClass) _setPrototypeOf(subClass, superClass);
  680. }
  681. /***/ }),
  682. /***/ 16:
  683. /***/ (function(module, exports, __webpack_require__) {
  684. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  685. Copyright (c) 2017 Jed Watson.
  686. Licensed under the MIT License (MIT), see
  687. http://jedwatson.github.io/classnames
  688. */
  689. /* global define */
  690. (function () {
  691. 'use strict';
  692. var hasOwn = {}.hasOwnProperty;
  693. function classNames () {
  694. var classes = [];
  695. for (var i = 0; i < arguments.length; i++) {
  696. var arg = arguments[i];
  697. if (!arg) continue;
  698. var argType = typeof arg;
  699. if (argType === 'string' || argType === 'number') {
  700. classes.push(arg);
  701. } else if (Array.isArray(arg) && arg.length) {
  702. var inner = classNames.apply(null, arg);
  703. if (inner) {
  704. classes.push(inner);
  705. }
  706. } else if (argType === 'object') {
  707. for (var key in arg) {
  708. if (hasOwn.call(arg, key) && arg[key]) {
  709. classes.push(key);
  710. }
  711. }
  712. }
  713. }
  714. return classes.join(' ');
  715. }
  716. if ( true && module.exports) {
  717. classNames.default = classNames;
  718. module.exports = classNames;
  719. } else if (true) {
  720. // register as 'classnames', consistent with npm package name
  721. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  722. return classNames;
  723. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  724. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  725. } else {}
  726. }());
  727. /***/ }),
  728. /***/ 17:
  729. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  730. "use strict";
  731. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
  732. function _arrayWithoutHoles(arr) {
  733. if (Array.isArray(arr)) {
  734. for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
  735. arr2[i] = arr[i];
  736. }
  737. return arr2;
  738. }
  739. }
  740. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
  741. var iterableToArray = __webpack_require__(30);
  742. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
  743. function _nonIterableSpread() {
  744. throw new TypeError("Invalid attempt to spread non-iterable instance");
  745. }
  746. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
  747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
  748. function _toConsumableArray(arr) {
  749. return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread();
  750. }
  751. /***/ }),
  752. /***/ 18:
  753. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  754. "use strict";
  755. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
  756. function _extends() {
  757. _extends = Object.assign || function (target) {
  758. for (var i = 1; i < arguments.length; i++) {
  759. var source = arguments[i];
  760. for (var key in source) {
  761. if (Object.prototype.hasOwnProperty.call(source, key)) {
  762. target[key] = source[key];
  763. }
  764. }
  765. }
  766. return target;
  767. };
  768. return _extends.apply(this, arguments);
  769. }
  770. /***/ }),
  771. /***/ 19:
  772. /***/ (function(module, exports) {
  773. (function() { module.exports = this["wp"]["keycodes"]; }());
  774. /***/ }),
  775. /***/ 2:
  776. /***/ (function(module, exports) {
  777. (function() { module.exports = this["lodash"]; }());
  778. /***/ }),
  779. /***/ 20:
  780. /***/ (function(module, exports, __webpack_require__) {
  781. module.exports = __webpack_require__(47);
  782. /***/ }),
  783. /***/ 21:
  784. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  785. "use strict";
  786. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
  787. function _objectWithoutPropertiesLoose(source, excluded) {
  788. if (source == null) return {};
  789. var target = {};
  790. var sourceKeys = Object.keys(source);
  791. var key, i;
  792. for (i = 0; i < sourceKeys.length; i++) {
  793. key = sourceKeys[i];
  794. if (excluded.indexOf(key) >= 0) continue;
  795. target[key] = source[key];
  796. }
  797. return target;
  798. }
  799. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
  800. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; });
  801. function _objectWithoutProperties(source, excluded) {
  802. if (source == null) return {};
  803. var target = _objectWithoutPropertiesLoose(source, excluded);
  804. var key, i;
  805. if (Object.getOwnPropertySymbols) {
  806. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  807. for (i = 0; i < sourceSymbolKeys.length; i++) {
  808. key = sourceSymbolKeys[i];
  809. if (excluded.indexOf(key) >= 0) continue;
  810. if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
  811. target[key] = source[key];
  812. }
  813. }
  814. return target;
  815. }
  816. /***/ }),
  817. /***/ 22:
  818. /***/ (function(module, exports) {
  819. (function() { module.exports = this["wp"]["richText"]; }());
  820. /***/ }),
  821. /***/ 23:
  822. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  823. "use strict";
  824. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
  825. var arrayWithHoles = __webpack_require__(38);
  826. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
  827. function _iterableToArrayLimit(arr, i) {
  828. var _arr = [];
  829. var _n = true;
  830. var _d = false;
  831. var _e = undefined;
  832. try {
  833. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  834. _arr.push(_s.value);
  835. if (i && _arr.length === i) break;
  836. }
  837. } catch (err) {
  838. _d = true;
  839. _e = err;
  840. } finally {
  841. try {
  842. if (!_n && _i["return"] != null) _i["return"]();
  843. } finally {
  844. if (_d) throw _e;
  845. }
  846. }
  847. return _arr;
  848. }
  849. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
  850. var nonIterableRest = __webpack_require__(39);
  851. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
  852. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; });
  853. function _slicedToArray(arr, i) {
  854. return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])();
  855. }
  856. /***/ }),
  857. /***/ 26:
  858. /***/ (function(module, exports) {
  859. (function() { module.exports = this["wp"]["url"]; }());
  860. /***/ }),
  861. /***/ 27:
  862. /***/ (function(module, exports) {
  863. (function() { module.exports = this["wp"]["hooks"]; }());
  864. /***/ }),
  865. /***/ 28:
  866. /***/ (function(module, exports) {
  867. (function() { module.exports = this["React"]; }());
  868. /***/ }),
  869. /***/ 3:
  870. /***/ (function(module, exports) {
  871. (function() { module.exports = this["wp"]["components"]; }());
  872. /***/ }),
  873. /***/ 30:
  874. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  875. "use strict";
  876. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
  877. function _iterableToArray(iter) {
  878. if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
  879. }
  880. /***/ }),
  881. /***/ 31:
  882. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  883. "use strict";
  884. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
  885. function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
  886. function _typeof(obj) {
  887. if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
  888. _typeof = function _typeof(obj) {
  889. return _typeof2(obj);
  890. };
  891. } else {
  892. _typeof = function _typeof(obj) {
  893. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
  894. };
  895. }
  896. return _typeof(obj);
  897. }
  898. /***/ }),
  899. /***/ 32:
  900. /***/ (function(module, exports) {
  901. (function() { module.exports = this["wp"]["dataControls"]; }());
  902. /***/ }),
  903. /***/ 325:
  904. /***/ (function(module, exports, __webpack_require__) {
  905. "use strict";
  906. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  907. function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
  908. var BEGIN = 'BEGIN';
  909. var COMMIT = 'COMMIT';
  910. var REVERT = 'REVERT';
  911. // Array({transactionID: string or null, beforeState: {object}, action: {object}}
  912. var INITIAL_OPTIMIST = [];
  913. module.exports = optimist;
  914. module.exports.BEGIN = BEGIN;
  915. module.exports.COMMIT = COMMIT;
  916. module.exports.REVERT = REVERT;
  917. function optimist(fn) {
  918. function beginReducer(state, action) {
  919. var _separateState = separateState(state);
  920. var optimist = _separateState.optimist;
  921. var innerState = _separateState.innerState;
  922. optimist = optimist.concat([{ beforeState: innerState, action: action }]);
  923. innerState = fn(innerState, action);
  924. validateState(innerState, action);
  925. return _extends({ optimist: optimist }, innerState);
  926. }
  927. function commitReducer(state, action) {
  928. var _separateState2 = separateState(state);
  929. var optimist = _separateState2.optimist;
  930. var innerState = _separateState2.innerState;
  931. var newOptimist = [],
  932. started = false,
  933. committed = false;
  934. optimist.forEach(function (entry) {
  935. if (started) {
  936. if (entry.beforeState && matchesTransaction(entry.action, action.optimist.id)) {
  937. committed = true;
  938. newOptimist.push({ action: entry.action });
  939. } else {
  940. newOptimist.push(entry);
  941. }
  942. } else if (entry.beforeState && !matchesTransaction(entry.action, action.optimist.id)) {
  943. started = true;
  944. newOptimist.push(entry);
  945. } else if (entry.beforeState && matchesTransaction(entry.action, action.optimist.id)) {
  946. committed = true;
  947. }
  948. });
  949. if (!committed) {
  950. console.error('Cannot commit transaction with id "' + action.optimist.id + '" because it does not exist');
  951. }
  952. optimist = newOptimist;
  953. return baseReducer(optimist, innerState, action);
  954. }
  955. function revertReducer(state, action) {
  956. var _separateState3 = separateState(state);
  957. var optimist = _separateState3.optimist;
  958. var innerState = _separateState3.innerState;
  959. var newOptimist = [],
  960. started = false,
  961. gotInitialState = false,
  962. currentState = innerState;
  963. optimist.forEach(function (entry) {
  964. if (entry.beforeState && matchesTransaction(entry.action, action.optimist.id)) {
  965. currentState = entry.beforeState;
  966. gotInitialState = true;
  967. }
  968. if (!matchesTransaction(entry.action, action.optimist.id)) {
  969. if (entry.beforeState) {
  970. started = true;
  971. }
  972. if (started) {
  973. if (gotInitialState && entry.beforeState) {
  974. newOptimist.push({
  975. beforeState: currentState,
  976. action: entry.action
  977. });
  978. } else {
  979. newOptimist.push(entry);
  980. }
  981. }
  982. if (gotInitialState) {
  983. currentState = fn(currentState, entry.action);
  984. validateState(innerState, action);
  985. }
  986. }
  987. });
  988. if (!gotInitialState) {
  989. console.error('Cannot revert transaction with id "' + action.optimist.id + '" because it does not exist');
  990. }
  991. optimist = newOptimist;
  992. return baseReducer(optimist, currentState, action);
  993. }
  994. function baseReducer(optimist, innerState, action) {
  995. if (optimist.length) {
  996. optimist = optimist.concat([{ action: action }]);
  997. }
  998. innerState = fn(innerState, action);
  999. validateState(innerState, action);
  1000. return _extends({ optimist: optimist }, innerState);
  1001. }
  1002. return function (state, action) {
  1003. if (action.optimist) {
  1004. switch (action.optimist.type) {
  1005. case BEGIN:
  1006. return beginReducer(state, action);
  1007. case COMMIT:
  1008. return commitReducer(state, action);
  1009. case REVERT:
  1010. return revertReducer(state, action);
  1011. }
  1012. }
  1013. var _separateState4 = separateState(state);
  1014. var optimist = _separateState4.optimist;
  1015. var innerState = _separateState4.innerState;
  1016. if (state && !optimist.length) {
  1017. var nextState = fn(innerState, action);
  1018. if (nextState === innerState) {
  1019. return state;
  1020. }
  1021. validateState(nextState, action);
  1022. return _extends({ optimist: optimist }, nextState);
  1023. }
  1024. return baseReducer(optimist, innerState, action);
  1025. };
  1026. }
  1027. function matchesTransaction(action, id) {
  1028. return action.optimist && action.optimist.id === id;
  1029. }
  1030. function validateState(newState, action) {
  1031. if (!newState || typeof newState !== 'object' || Array.isArray(newState)) {
  1032. throw new TypeError('Error while handling "' + action.type + '": Optimist requires that state is always a plain object.');
  1033. }
  1034. }
  1035. function separateState(state) {
  1036. if (!state) {
  1037. return { optimist: INITIAL_OPTIMIST, innerState: state };
  1038. } else {
  1039. var _state$optimist = state.optimist;
  1040. var _optimist = _state$optimist === undefined ? INITIAL_OPTIMIST : _state$optimist;
  1041. var innerState = _objectWithoutProperties(state, ['optimist']);
  1042. return { optimist: _optimist, innerState: innerState };
  1043. }
  1044. }
  1045. /***/ }),
  1046. /***/ 33:
  1047. /***/ (function(module, exports, __webpack_require__) {
  1048. /**
  1049. * Copyright (c) 2013-present, Facebook, Inc.
  1050. *
  1051. * This source code is licensed under the MIT license found in the
  1052. * LICENSE file in the root directory of this source tree.
  1053. */
  1054. if (false) { var throwOnDirectAccess, ReactIs; } else {
  1055. // By explicitly using `prop-types` you are opting into new production behavior.
  1056. // http://fb.me/prop-types-in-prod
  1057. module.exports = __webpack_require__(87)();
  1058. }
  1059. /***/ }),
  1060. /***/ 34:
  1061. /***/ (function(module, exports) {
  1062. (function() { module.exports = this["wp"]["apiFetch"]; }());
  1063. /***/ }),
  1064. /***/ 343:
  1065. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1066. "use strict";
  1067. __webpack_require__.r(__webpack_exports__);
  1068. var meta_namespaceObject = {};
  1069. __webpack_require__.r(meta_namespaceObject);
  1070. __webpack_require__.d(meta_namespaceObject, "getDependencies", function() { return getDependencies; });
  1071. __webpack_require__.d(meta_namespaceObject, "apply", function() { return apply; });
  1072. __webpack_require__.d(meta_namespaceObject, "update", function() { return update; });
  1073. var block_sources_namespaceObject = {};
  1074. __webpack_require__.r(block_sources_namespaceObject);
  1075. __webpack_require__.d(block_sources_namespaceObject, "meta", function() { return meta_namespaceObject; });
  1076. var actions_namespaceObject = {};
  1077. __webpack_require__.r(actions_namespaceObject);
  1078. __webpack_require__.d(actions_namespaceObject, "setupEditor", function() { return setupEditor; });
  1079. __webpack_require__.d(actions_namespaceObject, "__experimentalTearDownEditor", function() { return __experimentalTearDownEditor; });
  1080. __webpack_require__.d(actions_namespaceObject, "__experimentalSubscribeSources", function() { return __experimentalSubscribeSources; });
  1081. __webpack_require__.d(actions_namespaceObject, "resetPost", function() { return resetPost; });
  1082. __webpack_require__.d(actions_namespaceObject, "resetAutosave", function() { return resetAutosave; });
  1083. __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateStart", function() { return __experimentalRequestPostUpdateStart; });
  1084. __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateFinish", function() { return __experimentalRequestPostUpdateFinish; });
  1085. __webpack_require__.d(actions_namespaceObject, "updatePost", function() { return updatePost; });
  1086. __webpack_require__.d(actions_namespaceObject, "setupEditorState", function() { return setupEditorState; });
  1087. __webpack_require__.d(actions_namespaceObject, "editPost", function() { return actions_editPost; });
  1088. __webpack_require__.d(actions_namespaceObject, "__experimentalOptimisticUpdatePost", function() { return __experimentalOptimisticUpdatePost; });
  1089. __webpack_require__.d(actions_namespaceObject, "savePost", function() { return savePost; });
  1090. __webpack_require__.d(actions_namespaceObject, "refreshPost", function() { return refreshPost; });
  1091. __webpack_require__.d(actions_namespaceObject, "trashPost", function() { return trashPost; });
  1092. __webpack_require__.d(actions_namespaceObject, "autosave", function() { return actions_autosave; });
  1093. __webpack_require__.d(actions_namespaceObject, "__experimentalLocalAutosave", function() { return actions_experimentalLocalAutosave; });
  1094. __webpack_require__.d(actions_namespaceObject, "redo", function() { return actions_redo; });
  1095. __webpack_require__.d(actions_namespaceObject, "undo", function() { return actions_undo; });
  1096. __webpack_require__.d(actions_namespaceObject, "createUndoLevel", function() { return createUndoLevel; });
  1097. __webpack_require__.d(actions_namespaceObject, "updatePostLock", function() { return updatePostLock; });
  1098. __webpack_require__.d(actions_namespaceObject, "__experimentalFetchReusableBlocks", function() { return __experimentalFetchReusableBlocks; });
  1099. __webpack_require__.d(actions_namespaceObject, "__experimentalReceiveReusableBlocks", function() { return __experimentalReceiveReusableBlocks; });
  1100. __webpack_require__.d(actions_namespaceObject, "__experimentalSaveReusableBlock", function() { return __experimentalSaveReusableBlock; });
  1101. __webpack_require__.d(actions_namespaceObject, "__experimentalDeleteReusableBlock", function() { return __experimentalDeleteReusableBlock; });
  1102. __webpack_require__.d(actions_namespaceObject, "__experimentalUpdateReusableBlock", function() { return __experimentalUpdateReusableBlock; });
  1103. __webpack_require__.d(actions_namespaceObject, "__experimentalConvertBlockToStatic", function() { return __experimentalConvertBlockToStatic; });
  1104. __webpack_require__.d(actions_namespaceObject, "__experimentalConvertBlockToReusable", function() { return __experimentalConvertBlockToReusable; });
  1105. __webpack_require__.d(actions_namespaceObject, "enablePublishSidebar", function() { return enablePublishSidebar; });
  1106. __webpack_require__.d(actions_namespaceObject, "disablePublishSidebar", function() { return disablePublishSidebar; });
  1107. __webpack_require__.d(actions_namespaceObject, "lockPostSaving", function() { return lockPostSaving; });
  1108. __webpack_require__.d(actions_namespaceObject, "unlockPostSaving", function() { return unlockPostSaving; });
  1109. __webpack_require__.d(actions_namespaceObject, "resetEditorBlocks", function() { return actions_resetEditorBlocks; });
  1110. __webpack_require__.d(actions_namespaceObject, "updateEditorSettings", function() { return updateEditorSettings; });
  1111. __webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return resetBlocks; });
  1112. __webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; });
  1113. __webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return updateBlock; });
  1114. __webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return updateBlockAttributes; });
  1115. __webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return selectBlock; });
  1116. __webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return startMultiSelect; });
  1117. __webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return stopMultiSelect; });
  1118. __webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return multiSelect; });
  1119. __webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return clearSelectedBlock; });
  1120. __webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return toggleSelection; });
  1121. __webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return actions_replaceBlocks; });
  1122. __webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return replaceBlock; });
  1123. __webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return moveBlocksDown; });
  1124. __webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return moveBlocksUp; });
  1125. __webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return moveBlockToPosition; });
  1126. __webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return insertBlock; });
  1127. __webpack_require__.d(actions_namespaceObject, "insertBlocks", function() { return insertBlocks; });
  1128. __webpack_require__.d(actions_namespaceObject, "showInsertionPoint", function() { return showInsertionPoint; });
  1129. __webpack_require__.d(actions_namespaceObject, "hideInsertionPoint", function() { return hideInsertionPoint; });
  1130. __webpack_require__.d(actions_namespaceObject, "setTemplateValidity", function() { return setTemplateValidity; });
  1131. __webpack_require__.d(actions_namespaceObject, "synchronizeTemplate", function() { return synchronizeTemplate; });
  1132. __webpack_require__.d(actions_namespaceObject, "mergeBlocks", function() { return mergeBlocks; });
  1133. __webpack_require__.d(actions_namespaceObject, "removeBlocks", function() { return actions_removeBlocks; });
  1134. __webpack_require__.d(actions_namespaceObject, "removeBlock", function() { return removeBlock; });
  1135. __webpack_require__.d(actions_namespaceObject, "toggleBlockMode", function() { return toggleBlockMode; });
  1136. __webpack_require__.d(actions_namespaceObject, "startTyping", function() { return startTyping; });
  1137. __webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return stopTyping; });
  1138. __webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return enterFormattedText; });
  1139. __webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return exitFormattedText; });
  1140. __webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return insertDefaultBlock; });
  1141. __webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return updateBlockListSettings; });
  1142. var selectors_namespaceObject = {};
  1143. __webpack_require__.r(selectors_namespaceObject);
  1144. __webpack_require__.d(selectors_namespaceObject, "hasEditorUndo", function() { return hasEditorUndo; });
  1145. __webpack_require__.d(selectors_namespaceObject, "hasEditorRedo", function() { return hasEditorRedo; });
  1146. __webpack_require__.d(selectors_namespaceObject, "isEditedPostNew", function() { return selectors_isEditedPostNew; });
  1147. __webpack_require__.d(selectors_namespaceObject, "hasChangedContent", function() { return hasChangedContent; });
  1148. __webpack_require__.d(selectors_namespaceObject, "isEditedPostDirty", function() { return selectors_isEditedPostDirty; });
  1149. __webpack_require__.d(selectors_namespaceObject, "isCleanNewPost", function() { return selectors_isCleanNewPost; });
  1150. __webpack_require__.d(selectors_namespaceObject, "getCurrentPost", function() { return selectors_getCurrentPost; });
  1151. __webpack_require__.d(selectors_namespaceObject, "getCurrentPostType", function() { return selectors_getCurrentPostType; });
  1152. __webpack_require__.d(selectors_namespaceObject, "getCurrentPostId", function() { return selectors_getCurrentPostId; });
  1153. __webpack_require__.d(selectors_namespaceObject, "getCurrentPostRevisionsCount", function() { return getCurrentPostRevisionsCount; });
  1154. __webpack_require__.d(selectors_namespaceObject, "getCurrentPostLastRevisionId", function() { return getCurrentPostLastRevisionId; });
  1155. __webpack_require__.d(selectors_namespaceObject, "getPostEdits", function() { return getPostEdits; });
  1156. __webpack_require__.d(selectors_namespaceObject, "getCurrentPostAttribute", function() { return selectors_getCurrentPostAttribute; });
  1157. __webpack_require__.d(selectors_namespaceObject, "getEditedPostAttribute", function() { return selectors_getEditedPostAttribute; });
  1158. __webpack_require__.d(selectors_namespaceObject, "getAutosaveAttribute", function() { return getAutosaveAttribute; });
  1159. __webpack_require__.d(selectors_namespaceObject, "getEditedPostVisibility", function() { return selectors_getEditedPostVisibility; });
  1160. __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPending", function() { return isCurrentPostPending; });
  1161. __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPublished", function() { return selectors_isCurrentPostPublished; });
  1162. __webpack_require__.d(selectors_namespaceObject, "isCurrentPostScheduled", function() { return selectors_isCurrentPostScheduled; });
  1163. __webpack_require__.d(selectors_namespaceObject, "isEditedPostPublishable", function() { return selectors_isEditedPostPublishable; });
  1164. __webpack_require__.d(selectors_namespaceObject, "isEditedPostSaveable", function() { return selectors_isEditedPostSaveable; });
  1165. __webpack_require__.d(selectors_namespaceObject, "isEditedPostEmpty", function() { return isEditedPostEmpty; });
  1166. __webpack_require__.d(selectors_namespaceObject, "isEditedPostAutosaveable", function() { return selectors_isEditedPostAutosaveable; });
  1167. __webpack_require__.d(selectors_namespaceObject, "getAutosave", function() { return getAutosave; });
  1168. __webpack_require__.d(selectors_namespaceObject, "hasAutosave", function() { return hasAutosave; });
  1169. __webpack_require__.d(selectors_namespaceObject, "isEditedPostBeingScheduled", function() { return selectors_isEditedPostBeingScheduled; });
  1170. __webpack_require__.d(selectors_namespaceObject, "isEditedPostDateFloating", function() { return isEditedPostDateFloating; });
  1171. __webpack_require__.d(selectors_namespaceObject, "isSavingPost", function() { return selectors_isSavingPost; });
  1172. __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestSucceed", function() { return didPostSaveRequestSucceed; });
  1173. __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestFail", function() { return didPostSaveRequestFail; });
  1174. __webpack_require__.d(selectors_namespaceObject, "isAutosavingPost", function() { return selectors_isAutosavingPost; });
  1175. __webpack_require__.d(selectors_namespaceObject, "isPreviewingPost", function() { return isPreviewingPost; });
  1176. __webpack_require__.d(selectors_namespaceObject, "getEditedPostPreviewLink", function() { return selectors_getEditedPostPreviewLink; });
  1177. __webpack_require__.d(selectors_namespaceObject, "getSuggestedPostFormat", function() { return selectors_getSuggestedPostFormat; });
  1178. __webpack_require__.d(selectors_namespaceObject, "getBlocksForSerialization", function() { return getBlocksForSerialization; });
  1179. __webpack_require__.d(selectors_namespaceObject, "getEditedPostContent", function() { return getEditedPostContent; });
  1180. __webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlock", function() { return __experimentalGetReusableBlock; });
  1181. __webpack_require__.d(selectors_namespaceObject, "__experimentalIsSavingReusableBlock", function() { return __experimentalIsSavingReusableBlock; });
  1182. __webpack_require__.d(selectors_namespaceObject, "__experimentalIsFetchingReusableBlock", function() { return __experimentalIsFetchingReusableBlock; });
  1183. __webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlocks", function() { return selectors_experimentalGetReusableBlocks; });
  1184. __webpack_require__.d(selectors_namespaceObject, "getStateBeforeOptimisticTransaction", function() { return getStateBeforeOptimisticTransaction; });
  1185. __webpack_require__.d(selectors_namespaceObject, "isPublishingPost", function() { return selectors_isPublishingPost; });
  1186. __webpack_require__.d(selectors_namespaceObject, "isPermalinkEditable", function() { return selectors_isPermalinkEditable; });
  1187. __webpack_require__.d(selectors_namespaceObject, "getPermalink", function() { return getPermalink; });
  1188. __webpack_require__.d(selectors_namespaceObject, "getPermalinkParts", function() { return selectors_getPermalinkParts; });
  1189. __webpack_require__.d(selectors_namespaceObject, "inSomeHistory", function() { return inSomeHistory; });
  1190. __webpack_require__.d(selectors_namespaceObject, "isPostLocked", function() { return isPostLocked; });
  1191. __webpack_require__.d(selectors_namespaceObject, "isPostSavingLocked", function() { return selectors_isPostSavingLocked; });
  1192. __webpack_require__.d(selectors_namespaceObject, "isPostAutosavingLocked", function() { return isPostAutosavingLocked; });
  1193. __webpack_require__.d(selectors_namespaceObject, "isPostLockTakeover", function() { return isPostLockTakeover; });
  1194. __webpack_require__.d(selectors_namespaceObject, "getPostLockUser", function() { return getPostLockUser; });
  1195. __webpack_require__.d(selectors_namespaceObject, "getActivePostLock", function() { return getActivePostLock; });
  1196. __webpack_require__.d(selectors_namespaceObject, "canUserUseUnfilteredHTML", function() { return selectors_canUserUseUnfilteredHTML; });
  1197. __webpack_require__.d(selectors_namespaceObject, "isPublishSidebarEnabled", function() { return selectors_isPublishSidebarEnabled; });
  1198. __webpack_require__.d(selectors_namespaceObject, "getEditorBlocks", function() { return selectors_getEditorBlocks; });
  1199. __webpack_require__.d(selectors_namespaceObject, "__unstableIsEditorReady", function() { return __unstableIsEditorReady; });
  1200. __webpack_require__.d(selectors_namespaceObject, "getEditorSettings", function() { return selectors_getEditorSettings; });
  1201. __webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return selectors_getBlockName; });
  1202. __webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return isBlockValid; });
  1203. __webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return getBlockAttributes; });
  1204. __webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return selectors_getBlock; });
  1205. __webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; });
  1206. __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return __unstableGetBlockWithoutInnerBlocks; });
  1207. __webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return getClientIdsOfDescendants; });
  1208. __webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; });
  1209. __webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return getGlobalBlockCount; });
  1210. __webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return selectors_getBlocksByClientId; });
  1211. __webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return getBlockCount; });
  1212. __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return getBlockSelectionStart; });
  1213. __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return getBlockSelectionEnd; });
  1214. __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return getSelectedBlockCount; });
  1215. __webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return hasSelectedBlock; });
  1216. __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return selectors_getSelectedBlockClientId; });
  1217. __webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return getSelectedBlock; });
  1218. __webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return getBlockRootClientId; });
  1219. __webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return getBlockHierarchyRootClientId; });
  1220. __webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; });
  1221. __webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return getPreviousBlockClientId; });
  1222. __webpack_require__.d(selectors_namespaceObject, "getNextBlockClientId", function() { return getNextBlockClientId; });
  1223. __webpack_require__.d(selectors_namespaceObject, "getSelectedBlocksInitialCaretPosition", function() { return getSelectedBlocksInitialCaretPosition; });
  1224. __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlockClientIds", function() { return getMultiSelectedBlockClientIds; });
  1225. __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocks", function() { return getMultiSelectedBlocks; });
  1226. __webpack_require__.d(selectors_namespaceObject, "getFirstMultiSelectedBlockClientId", function() { return getFirstMultiSelectedBlockClientId; });
  1227. __webpack_require__.d(selectors_namespaceObject, "getLastMultiSelectedBlockClientId", function() { return getLastMultiSelectedBlockClientId; });
  1228. __webpack_require__.d(selectors_namespaceObject, "isFirstMultiSelectedBlock", function() { return isFirstMultiSelectedBlock; });
  1229. __webpack_require__.d(selectors_namespaceObject, "isBlockMultiSelected", function() { return isBlockMultiSelected; });
  1230. __webpack_require__.d(selectors_namespaceObject, "isAncestorMultiSelected", function() { return isAncestorMultiSelected; });
  1231. __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksStartClientId", function() { return getMultiSelectedBlocksStartClientId; });
  1232. __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksEndClientId", function() { return getMultiSelectedBlocksEndClientId; });
  1233. __webpack_require__.d(selectors_namespaceObject, "getBlockOrder", function() { return getBlockOrder; });
  1234. __webpack_require__.d(selectors_namespaceObject, "getBlockIndex", function() { return getBlockIndex; });
  1235. __webpack_require__.d(selectors_namespaceObject, "isBlockSelected", function() { return isBlockSelected; });
  1236. __webpack_require__.d(selectors_namespaceObject, "hasSelectedInnerBlock", function() { return hasSelectedInnerBlock; });
  1237. __webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; });
  1238. __webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return hasMultiSelection; });
  1239. __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return isMultiSelecting; });
  1240. __webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return isSelectionEnabled; });
  1241. __webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return getBlockMode; });
  1242. __webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return isTyping; });
  1243. __webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return isCaretWithinFormattedText; });
  1244. __webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return getBlockInsertionPoint; });
  1245. __webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return isBlockInsertionPointVisible; });
  1246. __webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return isValidTemplate; });
  1247. __webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; });
  1248. __webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return getTemplateLock; });
  1249. __webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return selectors_canInsertBlockType; });
  1250. __webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return selectors_getInserterItems; });
  1251. __webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return hasInserterItems; });
  1252. __webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return getBlockListSettings; });
  1253. var store_selectors_namespaceObject = {};
  1254. __webpack_require__.r(store_selectors_namespaceObject);
  1255. __webpack_require__.d(store_selectors_namespaceObject, "isRequestingDownloadableBlocks", function() { return isRequestingDownloadableBlocks; });
  1256. __webpack_require__.d(store_selectors_namespaceObject, "getDownloadableBlocks", function() { return selectors_getDownloadableBlocks; });
  1257. __webpack_require__.d(store_selectors_namespaceObject, "hasInstallBlocksPermission", function() { return selectors_hasInstallBlocksPermission; });
  1258. __webpack_require__.d(store_selectors_namespaceObject, "getInstalledBlockTypes", function() { return selectors_getInstalledBlockTypes; });
  1259. var store_actions_namespaceObject = {};
  1260. __webpack_require__.r(store_actions_namespaceObject);
  1261. __webpack_require__.d(store_actions_namespaceObject, "fetchDownloadableBlocks", function() { return fetchDownloadableBlocks; });
  1262. __webpack_require__.d(store_actions_namespaceObject, "receiveDownloadableBlocks", function() { return receiveDownloadableBlocks; });
  1263. __webpack_require__.d(store_actions_namespaceObject, "setInstallBlocksPermission", function() { return setInstallBlocksPermission; });
  1264. __webpack_require__.d(store_actions_namespaceObject, "downloadBlock", function() { return actions_downloadBlock; });
  1265. __webpack_require__.d(store_actions_namespaceObject, "installBlock", function() { return actions_installBlock; });
  1266. __webpack_require__.d(store_actions_namespaceObject, "uninstallBlock", function() { return uninstallBlock; });
  1267. __webpack_require__.d(store_actions_namespaceObject, "addInstalledBlockType", function() { return addInstalledBlockType; });
  1268. __webpack_require__.d(store_actions_namespaceObject, "removeInstalledBlockType", function() { return removeInstalledBlockType; });
  1269. // EXTERNAL MODULE: external {"this":["wp","blockEditor"]}
  1270. var external_this_wp_blockEditor_ = __webpack_require__(6);
  1271. // EXTERNAL MODULE: external {"this":["wp","blocks"]}
  1272. var external_this_wp_blocks_ = __webpack_require__(9);
  1273. // EXTERNAL MODULE: external {"this":["wp","coreData"]}
  1274. var external_this_wp_coreData_ = __webpack_require__(89);
  1275. // EXTERNAL MODULE: external {"this":["wp","notices"]}
  1276. var external_this_wp_notices_ = __webpack_require__(142);
  1277. // EXTERNAL MODULE: external {"this":["wp","nux"]}
  1278. var external_this_wp_nux_ = __webpack_require__(61);
  1279. // EXTERNAL MODULE: external {"this":["wp","richText"]}
  1280. var external_this_wp_richText_ = __webpack_require__(22);
  1281. // EXTERNAL MODULE: external {"this":["wp","viewport"]}
  1282. var external_this_wp_viewport_ = __webpack_require__(42);
  1283. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
  1284. var objectSpread = __webpack_require__(7);
  1285. // EXTERNAL MODULE: external {"this":["wp","data"]}
  1286. var external_this_wp_data_ = __webpack_require__(4);
  1287. // EXTERNAL MODULE: external {"this":["wp","dataControls"]}
  1288. var external_this_wp_dataControls_ = __webpack_require__(32);
  1289. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
  1290. var defineProperty = __webpack_require__(10);
  1291. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
  1292. var esm_typeof = __webpack_require__(31);
  1293. // EXTERNAL MODULE: ./node_modules/redux-optimist/index.js
  1294. var redux_optimist = __webpack_require__(83);
  1295. var redux_optimist_default = /*#__PURE__*/__webpack_require__.n(redux_optimist);
  1296. // EXTERNAL MODULE: external "lodash"
  1297. var external_lodash_ = __webpack_require__(2);
  1298. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js
  1299. /**
  1300. * WordPress dependencies
  1301. */
  1302. var PREFERENCES_DEFAULTS = {
  1303. insertUsage: {},
  1304. // Should be kept for backward compatibility, see: https://github.com/WordPress/gutenberg/issues/14580.
  1305. isPublishSidebarEnabled: true
  1306. };
  1307. /**
  1308. * The default post editor settings
  1309. *
  1310. * allowedBlockTypes boolean|Array Allowed block types
  1311. * richEditingEnabled boolean Whether rich editing is enabled or not
  1312. * codeEditingEnabled boolean Whether code editing is enabled or not
  1313. * enableCustomFields boolean Whether the WordPress custom fields are enabled or not
  1314. * autosaveInterval number Autosave Interval
  1315. * availableTemplates array? The available post templates
  1316. * disablePostFormats boolean Whether or not the post formats are disabled
  1317. * allowedMimeTypes array? List of allowed mime types and file extensions
  1318. * maxUploadFileSize number Maximum upload file size
  1319. */
  1320. var EDITOR_SETTINGS_DEFAULTS = Object(objectSpread["a" /* default */])({}, external_this_wp_blockEditor_["SETTINGS_DEFAULTS"], {
  1321. richEditingEnabled: true,
  1322. codeEditingEnabled: true,
  1323. enableCustomFields: false
  1324. });
  1325. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js
  1326. /**
  1327. * External dependencies
  1328. */
  1329. /**
  1330. * WordPress dependencies
  1331. */
  1332. /**
  1333. * Internal dependencies
  1334. */
  1335. /**
  1336. * Returns a post attribute value, flattening nested rendered content using its
  1337. * raw value in place of its original object form.
  1338. *
  1339. * @param {*} value Original value.
  1340. *
  1341. * @return {*} Raw value.
  1342. */
  1343. function getPostRawValue(value) {
  1344. if (value && 'object' === Object(esm_typeof["a" /* default */])(value) && 'raw' in value) {
  1345. return value.raw;
  1346. }
  1347. return value;
  1348. }
  1349. /**
  1350. * Returns true if the two object arguments have the same keys, or false
  1351. * otherwise.
  1352. *
  1353. * @param {Object} a First object.
  1354. * @param {Object} b Second object.
  1355. *
  1356. * @return {boolean} Whether the two objects have the same keys.
  1357. */
  1358. function hasSameKeys(a, b) {
  1359. return Object(external_lodash_["isEqual"])(Object(external_lodash_["keys"])(a), Object(external_lodash_["keys"])(b));
  1360. }
  1361. /**
  1362. * Returns true if, given the currently dispatching action and the previously
  1363. * dispatched action, the two actions are editing the same post property, or
  1364. * false otherwise.
  1365. *
  1366. * @param {Object} action Currently dispatching action.
  1367. * @param {Object} previousAction Previously dispatched action.
  1368. *
  1369. * @return {boolean} Whether actions are updating the same post property.
  1370. */
  1371. function isUpdatingSamePostProperty(action, previousAction) {
  1372. return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits);
  1373. }
  1374. /**
  1375. * Returns true if, given the currently dispatching action and the previously
  1376. * dispatched action, the two actions are modifying the same property such that
  1377. * undo history should be batched.
  1378. *
  1379. * @param {Object} action Currently dispatching action.
  1380. * @param {Object} previousAction Previously dispatched action.
  1381. *
  1382. * @return {boolean} Whether to overwrite present state.
  1383. */
  1384. function shouldOverwriteState(action, previousAction) {
  1385. if (action.type === 'RESET_EDITOR_BLOCKS') {
  1386. return !action.shouldCreateUndoLevel;
  1387. }
  1388. if (!previousAction || action.type !== previousAction.type) {
  1389. return false;
  1390. }
  1391. return isUpdatingSamePostProperty(action, previousAction);
  1392. }
  1393. function reducer_postId() {
  1394. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  1395. var action = arguments.length > 1 ? arguments[1] : undefined;
  1396. switch (action.type) {
  1397. case 'SETUP_EDITOR_STATE':
  1398. case 'RESET_POST':
  1399. case 'UPDATE_POST':
  1400. return action.post.id;
  1401. }
  1402. return state;
  1403. }
  1404. function reducer_postType() {
  1405. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  1406. var action = arguments.length > 1 ? arguments[1] : undefined;
  1407. switch (action.type) {
  1408. case 'SETUP_EDITOR_STATE':
  1409. case 'RESET_POST':
  1410. case 'UPDATE_POST':
  1411. return action.post.type;
  1412. }
  1413. return state;
  1414. }
  1415. /**
  1416. * Reducer returning whether the post blocks match the defined template or not.
  1417. *
  1418. * @param {Object} state Current state.
  1419. * @param {Object} action Dispatched action.
  1420. *
  1421. * @return {boolean} Updated state.
  1422. */
  1423. function reducer_template() {
  1424. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  1425. isValid: true
  1426. };
  1427. var action = arguments.length > 1 ? arguments[1] : undefined;
  1428. switch (action.type) {
  1429. case 'SET_TEMPLATE_VALIDITY':
  1430. return Object(objectSpread["a" /* default */])({}, state, {
  1431. isValid: action.isValid
  1432. });
  1433. }
  1434. return state;
  1435. }
  1436. /**
  1437. * Reducer returning the user preferences.
  1438. *
  1439. * @param {Object} state Current state.
  1440. * @param {Object} action Dispatched action.
  1441. *
  1442. * @return {string} Updated state.
  1443. */
  1444. function preferences() {
  1445. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS;
  1446. var action = arguments.length > 1 ? arguments[1] : undefined;
  1447. switch (action.type) {
  1448. case 'ENABLE_PUBLISH_SIDEBAR':
  1449. return Object(objectSpread["a" /* default */])({}, state, {
  1450. isPublishSidebarEnabled: true
  1451. });
  1452. case 'DISABLE_PUBLISH_SIDEBAR':
  1453. return Object(objectSpread["a" /* default */])({}, state, {
  1454. isPublishSidebarEnabled: false
  1455. });
  1456. }
  1457. return state;
  1458. }
  1459. /**
  1460. * Reducer returning current network request state (whether a request to
  1461. * the WP REST API is in progress, successful, or failed).
  1462. *
  1463. * @param {Object} state Current state.
  1464. * @param {Object} action Dispatched action.
  1465. *
  1466. * @return {Object} Updated state.
  1467. */
  1468. function saving() {
  1469. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1470. var action = arguments.length > 1 ? arguments[1] : undefined;
  1471. switch (action.type) {
  1472. case 'REQUEST_POST_UPDATE_START':
  1473. case 'REQUEST_POST_UPDATE_FINISH':
  1474. return {
  1475. pending: action.type === 'REQUEST_POST_UPDATE_START',
  1476. options: action.options || {}
  1477. };
  1478. }
  1479. return state;
  1480. }
  1481. /**
  1482. * Post Lock State.
  1483. *
  1484. * @typedef {Object} PostLockState
  1485. *
  1486. * @property {boolean} isLocked Whether the post is locked.
  1487. * @property {?boolean} isTakeover Whether the post editing has been taken over.
  1488. * @property {?boolean} activePostLock Active post lock value.
  1489. * @property {?Object} user User that took over the post.
  1490. */
  1491. /**
  1492. * Reducer returning the post lock status.
  1493. *
  1494. * @param {PostLockState} state Current state.
  1495. * @param {Object} action Dispatched action.
  1496. *
  1497. * @return {PostLockState} Updated state.
  1498. */
  1499. function postLock() {
  1500. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  1501. isLocked: false
  1502. };
  1503. var action = arguments.length > 1 ? arguments[1] : undefined;
  1504. switch (action.type) {
  1505. case 'UPDATE_POST_LOCK':
  1506. return action.lock;
  1507. }
  1508. return state;
  1509. }
  1510. /**
  1511. * Post saving lock.
  1512. *
  1513. * When post saving is locked, the post cannot be published or updated.
  1514. *
  1515. * @param {PostSavingLockState} state Current state.
  1516. * @param {Object} action Dispatched action.
  1517. *
  1518. * @return {PostLockState} Updated state.
  1519. */
  1520. function postSavingLock() {
  1521. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1522. var action = arguments.length > 1 ? arguments[1] : undefined;
  1523. switch (action.type) {
  1524. case 'LOCK_POST_SAVING':
  1525. return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.lockName, true));
  1526. case 'UNLOCK_POST_SAVING':
  1527. return Object(external_lodash_["omit"])(state, action.lockName);
  1528. }
  1529. return state;
  1530. }
  1531. /**
  1532. * Post autosaving lock.
  1533. *
  1534. * When post autosaving is locked, the post will not autosave.
  1535. *
  1536. * @param {PostAutosavingLockState} state Current state.
  1537. * @param {Object} action Dispatched action.
  1538. *
  1539. * @return {PostLockState} Updated state.
  1540. */
  1541. function postAutosavingLock() {
  1542. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1543. var action = arguments.length > 1 ? arguments[1] : undefined;
  1544. switch (action.type) {
  1545. case 'LOCK_POST_AUTOSAVING':
  1546. return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.lockName, true));
  1547. case 'UNLOCK_POST_AUTOSAVING':
  1548. return Object(external_lodash_["omit"])(state, action.lockName);
  1549. }
  1550. return state;
  1551. }
  1552. var reducer_reusableBlocks = Object(external_this_wp_data_["combineReducers"])({
  1553. data: function data() {
  1554. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1555. var action = arguments.length > 1 ? arguments[1] : undefined;
  1556. switch (action.type) {
  1557. case 'RECEIVE_REUSABLE_BLOCKS':
  1558. {
  1559. return Object(objectSpread["a" /* default */])({}, state, Object(external_lodash_["keyBy"])(action.results, 'id'));
  1560. }
  1561. case 'UPDATE_REUSABLE_BLOCK':
  1562. {
  1563. var id = action.id,
  1564. changes = action.changes;
  1565. return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, id, Object(objectSpread["a" /* default */])({}, state[id], changes)));
  1566. }
  1567. case 'SAVE_REUSABLE_BLOCK_SUCCESS':
  1568. {
  1569. var _id = action.id,
  1570. updatedId = action.updatedId; // If a temporary reusable block is saved, we swap the temporary id with the final one
  1571. if (_id === updatedId) {
  1572. return state;
  1573. }
  1574. var value = state[_id];
  1575. return Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(state, _id), Object(defineProperty["a" /* default */])({}, updatedId, Object(objectSpread["a" /* default */])({}, value, {
  1576. id: updatedId
  1577. })));
  1578. }
  1579. case 'REMOVE_REUSABLE_BLOCK':
  1580. {
  1581. var _id2 = action.id;
  1582. return Object(external_lodash_["omit"])(state, _id2);
  1583. }
  1584. }
  1585. return state;
  1586. },
  1587. isFetching: function isFetching() {
  1588. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1589. var action = arguments.length > 1 ? arguments[1] : undefined;
  1590. switch (action.type) {
  1591. case 'FETCH_REUSABLE_BLOCKS':
  1592. {
  1593. var id = action.id;
  1594. if (!id) {
  1595. return state;
  1596. }
  1597. return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, id, true));
  1598. }
  1599. case 'FETCH_REUSABLE_BLOCKS_SUCCESS':
  1600. case 'FETCH_REUSABLE_BLOCKS_FAILURE':
  1601. {
  1602. var _id3 = action.id;
  1603. return Object(external_lodash_["omit"])(state, _id3);
  1604. }
  1605. }
  1606. return state;
  1607. },
  1608. isSaving: function isSaving() {
  1609. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1610. var action = arguments.length > 1 ? arguments[1] : undefined;
  1611. switch (action.type) {
  1612. case 'SAVE_REUSABLE_BLOCK':
  1613. return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.id, true));
  1614. case 'SAVE_REUSABLE_BLOCK_SUCCESS':
  1615. case 'SAVE_REUSABLE_BLOCK_FAILURE':
  1616. {
  1617. var id = action.id;
  1618. return Object(external_lodash_["omit"])(state, id);
  1619. }
  1620. }
  1621. return state;
  1622. }
  1623. });
  1624. /**
  1625. * Reducer returning whether the editor is ready to be rendered.
  1626. * The editor is considered ready to be rendered once
  1627. * the post object is loaded properly and the initial blocks parsed.
  1628. *
  1629. * @param {boolean} state
  1630. * @param {Object} action
  1631. *
  1632. * @return {boolean} Updated state.
  1633. */
  1634. function reducer_isReady() {
  1635. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  1636. var action = arguments.length > 1 ? arguments[1] : undefined;
  1637. switch (action.type) {
  1638. case 'SETUP_EDITOR_STATE':
  1639. return true;
  1640. case 'TEAR_DOWN_EDITOR':
  1641. return false;
  1642. }
  1643. return state;
  1644. }
  1645. /**
  1646. * Reducer returning the post editor setting.
  1647. *
  1648. * @param {Object} state Current state.
  1649. * @param {Object} action Dispatched action.
  1650. *
  1651. * @return {Object} Updated state.
  1652. */
  1653. function reducer_editorSettings() {
  1654. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EDITOR_SETTINGS_DEFAULTS;
  1655. var action = arguments.length > 1 ? arguments[1] : undefined;
  1656. switch (action.type) {
  1657. case 'UPDATE_EDITOR_SETTINGS':
  1658. return Object(objectSpread["a" /* default */])({}, state, action.settings);
  1659. }
  1660. return state;
  1661. }
  1662. /* harmony default export */ var reducer = (redux_optimist_default()(Object(external_this_wp_data_["combineReducers"])({
  1663. postId: reducer_postId,
  1664. postType: reducer_postType,
  1665. preferences: preferences,
  1666. saving: saving,
  1667. postLock: postLock,
  1668. reusableBlocks: reducer_reusableBlocks,
  1669. template: reducer_template,
  1670. postSavingLock: postSavingLock,
  1671. isReady: reducer_isReady,
  1672. editorSettings: reducer_editorSettings,
  1673. postAutosavingLock: postAutosavingLock
  1674. })));
  1675. // EXTERNAL MODULE: ./node_modules/refx/refx.js
  1676. var refx = __webpack_require__(72);
  1677. var refx_default = /*#__PURE__*/__webpack_require__.n(refx);
  1678. // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
  1679. var regenerator = __webpack_require__(20);
  1680. var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
  1681. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
  1682. var asyncToGenerator = __webpack_require__(43);
  1683. // EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
  1684. var external_this_wp_apiFetch_ = __webpack_require__(34);
  1685. var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
  1686. // EXTERNAL MODULE: external {"this":["wp","i18n"]}
  1687. var external_this_wp_i18n_ = __webpack_require__(1);
  1688. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
  1689. var slicedToArray = __webpack_require__(23);
  1690. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
  1691. var toConsumableArray = __webpack_require__(17);
  1692. // EXTERNAL MODULE: external {"this":["wp","deprecated"]}
  1693. var external_this_wp_deprecated_ = __webpack_require__(37);
  1694. var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_);
  1695. // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]}
  1696. var external_this_wp_isShallowEqual_ = __webpack_require__(41);
  1697. var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_);
  1698. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js
  1699. /**
  1700. * Set of post properties for which edits should assume a merging behavior,
  1701. * assuming an object value.
  1702. *
  1703. * @type {Set}
  1704. */
  1705. var EDIT_MERGE_PROPERTIES = new Set(['meta']);
  1706. /**
  1707. * Constant for the store module (or reducer) key.
  1708. *
  1709. * @type {string}
  1710. */
  1711. var STORE_KEY = 'core/editor';
  1712. var POST_UPDATE_TRANSACTION_ID = 'post-update';
  1713. var SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID';
  1714. var TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
  1715. var PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
  1716. var ONE_MINUTE_IN_MS = 60 * 1000;
  1717. var AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content'];
  1718. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js
  1719. /**
  1720. * WordPress dependencies
  1721. */
  1722. /**
  1723. * Internal dependencies
  1724. */
  1725. /**
  1726. * External dependencies
  1727. */
  1728. /**
  1729. * Builds the arguments for a success notification dispatch.
  1730. *
  1731. * @param {Object} data Incoming data to build the arguments from.
  1732. *
  1733. * @return {Array} Arguments for dispatch. An empty array signals no
  1734. * notification should be sent.
  1735. */
  1736. function getNotificationArgumentsForSaveSuccess(data) {
  1737. var previousPost = data.previousPost,
  1738. post = data.post,
  1739. postType = data.postType; // Autosaves are neither shown a notice nor redirected.
  1740. if (Object(external_lodash_["get"])(data.options, ['isAutosave'])) {
  1741. return [];
  1742. }
  1743. var publishStatus = ['publish', 'private', 'future'];
  1744. var isPublished = Object(external_lodash_["includes"])(publishStatus, previousPost.status);
  1745. var willPublish = Object(external_lodash_["includes"])(publishStatus, post.status);
  1746. var noticeMessage;
  1747. var shouldShowLink = Object(external_lodash_["get"])(postType, ['viewable'], false);
  1748. if (!isPublished && !willPublish) {
  1749. // If saving a non-published post, don't show notice.
  1750. noticeMessage = null;
  1751. } else if (isPublished && !willPublish) {
  1752. // If undoing publish status, show specific notice
  1753. noticeMessage = postType.labels.item_reverted_to_draft;
  1754. shouldShowLink = false;
  1755. } else if (!isPublished && willPublish) {
  1756. // If publishing or scheduling a post, show the corresponding
  1757. // publish message
  1758. noticeMessage = {
  1759. publish: postType.labels.item_published,
  1760. private: postType.labels.item_published_privately,
  1761. future: postType.labels.item_scheduled
  1762. }[post.status];
  1763. } else {
  1764. // Generic fallback notice
  1765. noticeMessage = postType.labels.item_updated;
  1766. }
  1767. if (noticeMessage) {
  1768. var actions = [];
  1769. if (shouldShowLink) {
  1770. actions.push({
  1771. label: postType.labels.view_item,
  1772. url: post.link
  1773. });
  1774. }
  1775. return [noticeMessage, {
  1776. id: SAVE_POST_NOTICE_ID,
  1777. type: 'snackbar',
  1778. actions: actions
  1779. }];
  1780. }
  1781. return [];
  1782. }
  1783. /**
  1784. * Builds the fail notification arguments for dispatch.
  1785. *
  1786. * @param {Object} data Incoming data to build the arguments with.
  1787. *
  1788. * @return {Array} Arguments for dispatch. An empty array signals no
  1789. * notification should be sent.
  1790. */
  1791. function getNotificationArgumentsForSaveFail(data) {
  1792. var post = data.post,
  1793. edits = data.edits,
  1794. error = data.error;
  1795. if (error && 'rest_autosave_no_changes' === error.code) {
  1796. // Autosave requested a new autosave, but there were no changes. This shouldn't
  1797. // result in an error notice for the user.
  1798. return [];
  1799. }
  1800. var publishStatus = ['publish', 'private', 'future'];
  1801. var isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message
  1802. // Unless we publish an "updating failed" message
  1803. var messages = {
  1804. publish: Object(external_this_wp_i18n_["__"])('Publishing failed.'),
  1805. private: Object(external_this_wp_i18n_["__"])('Publishing failed.'),
  1806. future: Object(external_this_wp_i18n_["__"])('Scheduling failed.')
  1807. };
  1808. var noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : Object(external_this_wp_i18n_["__"])('Updating failed.'); // Check if message string contains HTML. Notice text is currently only
  1809. // supported as plaintext, and stripping the tags may muddle the meaning.
  1810. if (error.message && !/<\/?[^>]*>/.test(error.message)) {
  1811. noticeMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('%1$s Error message: %2$s'), noticeMessage, error.message);
  1812. }
  1813. return [noticeMessage, {
  1814. id: SAVE_POST_NOTICE_ID
  1815. }];
  1816. }
  1817. /**
  1818. * Builds the trash fail notification arguments for dispatch.
  1819. *
  1820. * @param {Object} data
  1821. *
  1822. * @return {Array} Arguments for dispatch.
  1823. */
  1824. function getNotificationArgumentsForTrashFail(data) {
  1825. return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : Object(external_this_wp_i18n_["__"])('Trashing failed'), {
  1826. id: TRASH_POST_NOTICE_ID
  1827. }];
  1828. }
  1829. // EXTERNAL MODULE: ./node_modules/memize/index.js
  1830. var memize = __webpack_require__(44);
  1831. var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
  1832. // EXTERNAL MODULE: external {"this":["wp","autop"]}
  1833. var external_this_wp_autop_ = __webpack_require__(69);
  1834. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/serialize-blocks.js
  1835. /**
  1836. * External dependencies
  1837. */
  1838. /**
  1839. * WordPress dependencies
  1840. */
  1841. /**
  1842. * Serializes blocks following backwards compatibility conventions.
  1843. *
  1844. * @param {Array} blocksForSerialization The blocks to serialize.
  1845. *
  1846. * @return {string} The blocks serialization.
  1847. */
  1848. var serializeBlocks = memize_default()(function (blocksForSerialization) {
  1849. // A single unmodified default block is assumed to
  1850. // be equivalent to an empty post.
  1851. if (blocksForSerialization.length === 1 && Object(external_this_wp_blocks_["isUnmodifiedDefaultBlock"])(blocksForSerialization[0])) {
  1852. blocksForSerialization = [];
  1853. }
  1854. var content = Object(external_this_wp_blocks_["serialize"])(blocksForSerialization); // For compatibility, treat a post consisting of a
  1855. // single freeform block as legacy content and apply
  1856. // pre-block-editor removep'd content formatting.
  1857. if (blocksForSerialization.length === 1 && blocksForSerialization[0].name === Object(external_this_wp_blocks_["getFreeformContentHandlerName"])()) {
  1858. content = Object(external_this_wp_autop_["removep"])(content);
  1859. }
  1860. return content;
  1861. }, {
  1862. maxSize: 1
  1863. });
  1864. /* harmony default export */ var serialize_blocks = (serializeBlocks);
  1865. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/controls.js
  1866. /**
  1867. * WordPress dependencies
  1868. */
  1869. /**
  1870. * Returns a control descriptor signalling to subscribe to the registry and
  1871. * resolve the control promise only when the next state change occurs.
  1872. *
  1873. * @return {Object} Control descriptor.
  1874. */
  1875. function awaitNextStateChange() {
  1876. return {
  1877. type: 'AWAIT_NEXT_STATE_CHANGE'
  1878. };
  1879. }
  1880. /**
  1881. * Returns a control descriptor signalling to resolve with the current data
  1882. * registry.
  1883. *
  1884. * @return {Object} Control descriptor.
  1885. */
  1886. function getRegistry() {
  1887. return {
  1888. type: 'GET_REGISTRY'
  1889. };
  1890. }
  1891. /**
  1892. * Function returning a sessionStorage key to set or retrieve a given post's
  1893. * automatic session backup.
  1894. *
  1895. * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's
  1896. * `loggedout` handler can clear sessionStorage of any user-private content.
  1897. *
  1898. * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103
  1899. *
  1900. * @param {string} postId Post ID.
  1901. * @return {string} sessionStorage key
  1902. */
  1903. function postKey(postId) {
  1904. return "wp-autosave-block-editor-post-".concat(postId);
  1905. }
  1906. function localAutosaveGet(postId) {
  1907. return window.sessionStorage.getItem(postKey(postId));
  1908. }
  1909. function localAutosaveSet(postId, title, content, excerpt) {
  1910. window.sessionStorage.setItem(postKey(postId), JSON.stringify({
  1911. post_title: title,
  1912. content: content,
  1913. excerpt: excerpt
  1914. }));
  1915. }
  1916. function localAutosaveClear(postId) {
  1917. window.sessionStorage.removeItem(postKey(postId));
  1918. }
  1919. var controls = {
  1920. AWAIT_NEXT_STATE_CHANGE: Object(external_this_wp_data_["createRegistryControl"])(function (registry) {
  1921. return function () {
  1922. return new Promise(function (resolve) {
  1923. var unsubscribe = registry.subscribe(function () {
  1924. unsubscribe();
  1925. resolve();
  1926. });
  1927. });
  1928. };
  1929. }),
  1930. GET_REGISTRY: Object(external_this_wp_data_["createRegistryControl"])(function (registry) {
  1931. return function () {
  1932. return registry;
  1933. };
  1934. }),
  1935. LOCAL_AUTOSAVE_SET: function LOCAL_AUTOSAVE_SET(_ref) {
  1936. var postId = _ref.postId,
  1937. title = _ref.title,
  1938. content = _ref.content,
  1939. excerpt = _ref.excerpt;
  1940. localAutosaveSet(postId, title, content, excerpt);
  1941. }
  1942. };
  1943. /* harmony default export */ var store_controls = (controls);
  1944. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/block-sources/meta.js
  1945. var _marked =
  1946. /*#__PURE__*/
  1947. regenerator_default.a.mark(getDependencies),
  1948. _marked2 =
  1949. /*#__PURE__*/
  1950. regenerator_default.a.mark(update);
  1951. /**
  1952. * WordPress dependencies
  1953. */
  1954. /**
  1955. * Internal dependencies
  1956. */
  1957. /**
  1958. * Store control invoked upon a state change, responsible for returning an
  1959. * object of dependencies. When a change in dependencies occurs (by shallow
  1960. * equality of the returned object), blocks are reset to apply the new sourced
  1961. * value.
  1962. *
  1963. * @yield {Object} Optional yielded controls.
  1964. *
  1965. * @return {Object} Dependencies as object.
  1966. */
  1967. function getDependencies() {
  1968. return regenerator_default.a.wrap(function getDependencies$(_context) {
  1969. while (1) {
  1970. switch (_context.prev = _context.next) {
  1971. case 0:
  1972. _context.next = 2;
  1973. return Object(external_this_wp_dataControls_["select"])('core/editor', 'getEditedPostAttribute', 'meta');
  1974. case 2:
  1975. _context.t0 = _context.sent;
  1976. return _context.abrupt("return", {
  1977. meta: _context.t0
  1978. });
  1979. case 4:
  1980. case "end":
  1981. return _context.stop();
  1982. }
  1983. }
  1984. }, _marked);
  1985. }
  1986. /**
  1987. * Given an attribute schema and dependencies data, returns a source value.
  1988. *
  1989. * @param {Object} schema Block type attribute schema.
  1990. * @param {Object} dependencies Source dependencies.
  1991. * @param {Object} dependencies.meta Post meta.
  1992. *
  1993. * @return {Object} Block attribute value.
  1994. */
  1995. function apply(schema, _ref) {
  1996. var meta = _ref.meta;
  1997. return meta[schema.meta];
  1998. }
  1999. /**
  2000. * Store control invoked upon a block attributes update, responsible for
  2001. * reflecting an update in a meta value.
  2002. *
  2003. * @param {Object} schema Block type attribute schema.
  2004. * @param {*} value Updated block attribute value.
  2005. *
  2006. * @yield {Object} Yielded action objects or store controls.
  2007. */
  2008. function update(schema, value) {
  2009. return regenerator_default.a.wrap(function update$(_context2) {
  2010. while (1) {
  2011. switch (_context2.prev = _context2.next) {
  2012. case 0:
  2013. _context2.next = 2;
  2014. return actions_editPost({
  2015. meta: Object(defineProperty["a" /* default */])({}, schema.meta, value)
  2016. });
  2017. case 2:
  2018. case "end":
  2019. return _context2.stop();
  2020. }
  2021. }
  2022. }, _marked2);
  2023. }
  2024. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/block-sources/index.js
  2025. /**
  2026. * Internal dependencies
  2027. */
  2028. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js
  2029. var actions_marked =
  2030. /*#__PURE__*/
  2031. regenerator_default.a.mark(getBlocksWithSourcedAttributes),
  2032. actions_marked2 =
  2033. /*#__PURE__*/
  2034. regenerator_default.a.mark(resetLastBlockSourceDependencies),
  2035. _marked3 =
  2036. /*#__PURE__*/
  2037. regenerator_default.a.mark(setupEditor),
  2038. _marked4 =
  2039. /*#__PURE__*/
  2040. regenerator_default.a.mark(__experimentalSubscribeSources),
  2041. _marked5 =
  2042. /*#__PURE__*/
  2043. regenerator_default.a.mark(resetAutosave),
  2044. _marked6 =
  2045. /*#__PURE__*/
  2046. regenerator_default.a.mark(actions_editPost),
  2047. _marked7 =
  2048. /*#__PURE__*/
  2049. regenerator_default.a.mark(savePost),
  2050. _marked8 =
  2051. /*#__PURE__*/
  2052. regenerator_default.a.mark(refreshPost),
  2053. _marked9 =
  2054. /*#__PURE__*/
  2055. regenerator_default.a.mark(trashPost),
  2056. _marked10 =
  2057. /*#__PURE__*/
  2058. regenerator_default.a.mark(actions_autosave),
  2059. _marked11 =
  2060. /*#__PURE__*/
  2061. regenerator_default.a.mark(actions_experimentalLocalAutosave),
  2062. _marked12 =
  2063. /*#__PURE__*/
  2064. regenerator_default.a.mark(actions_redo),
  2065. _marked13 =
  2066. /*#__PURE__*/
  2067. regenerator_default.a.mark(actions_undo),
  2068. _marked14 =
  2069. /*#__PURE__*/
  2070. regenerator_default.a.mark(actions_resetEditorBlocks);
  2071. /**
  2072. * External dependencies
  2073. */
  2074. /**
  2075. * WordPress dependencies
  2076. */
  2077. /**
  2078. * Internal dependencies
  2079. */
  2080. /**
  2081. * Map of Registry instance to WeakMap of dependencies by custom source.
  2082. *
  2083. * @type WeakMap<WPDataRegistry,WeakMap<WPBlockAttributeSource,Object>>
  2084. */
  2085. var lastBlockSourceDependenciesByRegistry = new WeakMap();
  2086. /**
  2087. * Given a blocks array, returns a blocks array with sourced attribute values
  2088. * applied. The reference will remain consistent with the original argument if
  2089. * no attribute values must be overridden. If sourced values are applied, the
  2090. * return value will be a modified copy of the original array.
  2091. *
  2092. * @param {WPBlock[]} blocks Original blocks array.
  2093. *
  2094. * @return {WPBlock[]} Blocks array with sourced values applied.
  2095. */
  2096. function getBlocksWithSourcedAttributes(blocks) {
  2097. var registry, blockSourceDependencies, workingBlocks, i, block, blockType, _i, _Object$entries, _Object$entries$_i, attributeName, schema, dependencies, sourcedAttributeValue, appliedInnerBlocks;
  2098. return regenerator_default.a.wrap(function getBlocksWithSourcedAttributes$(_context) {
  2099. while (1) {
  2100. switch (_context.prev = _context.next) {
  2101. case 0:
  2102. _context.next = 2;
  2103. return getRegistry();
  2104. case 2:
  2105. registry = _context.sent;
  2106. if (lastBlockSourceDependenciesByRegistry.has(registry)) {
  2107. _context.next = 5;
  2108. break;
  2109. }
  2110. return _context.abrupt("return", blocks);
  2111. case 5:
  2112. blockSourceDependencies = lastBlockSourceDependenciesByRegistry.get(registry);
  2113. workingBlocks = blocks;
  2114. i = 0;
  2115. case 8:
  2116. if (!(i < blocks.length)) {
  2117. _context.next = 37;
  2118. break;
  2119. }
  2120. block = blocks[i];
  2121. _context.next = 12;
  2122. return Object(external_this_wp_dataControls_["select"])('core/blocks', 'getBlockType', block.name);
  2123. case 12:
  2124. blockType = _context.sent;
  2125. _i = 0, _Object$entries = Object.entries(blockType.attributes);
  2126. case 14:
  2127. if (!(_i < _Object$entries.length)) {
  2128. _context.next = 30;
  2129. break;
  2130. }
  2131. _Object$entries$_i = Object(slicedToArray["a" /* default */])(_Object$entries[_i], 2), attributeName = _Object$entries$_i[0], schema = _Object$entries$_i[1];
  2132. if (!(!block_sources_namespaceObject[schema.source] || !block_sources_namespaceObject[schema.source].apply)) {
  2133. _context.next = 18;
  2134. break;
  2135. }
  2136. return _context.abrupt("continue", 27);
  2137. case 18:
  2138. if (blockSourceDependencies.has(block_sources_namespaceObject[schema.source])) {
  2139. _context.next = 20;
  2140. break;
  2141. }
  2142. return _context.abrupt("continue", 27);
  2143. case 20:
  2144. dependencies = blockSourceDependencies.get(block_sources_namespaceObject[schema.source]);
  2145. sourcedAttributeValue = block_sources_namespaceObject[schema.source].apply(schema, dependencies); // It's only necessary to apply the value if it differs from the
  2146. // block's locally-assigned value, to avoid needlessly resetting
  2147. // the block editor.
  2148. if (!(sourcedAttributeValue === block.attributes[attributeName])) {
  2149. _context.next = 24;
  2150. break;
  2151. }
  2152. return _context.abrupt("continue", 27);
  2153. case 24:
  2154. // Create a shallow clone to mutate, leaving the original intact.
  2155. if (workingBlocks === blocks) {
  2156. workingBlocks = Object(toConsumableArray["a" /* default */])(workingBlocks);
  2157. }
  2158. block = Object(objectSpread["a" /* default */])({}, block, {
  2159. attributes: Object(objectSpread["a" /* default */])({}, block.attributes, Object(defineProperty["a" /* default */])({}, attributeName, sourcedAttributeValue))
  2160. });
  2161. workingBlocks.splice(i, 1, block);
  2162. case 27:
  2163. _i++;
  2164. _context.next = 14;
  2165. break;
  2166. case 30:
  2167. if (!block.innerBlocks.length) {
  2168. _context.next = 34;
  2169. break;
  2170. }
  2171. return _context.delegateYield(getBlocksWithSourcedAttributes(block.innerBlocks), "t0", 32);
  2172. case 32:
  2173. appliedInnerBlocks = _context.t0;
  2174. if (appliedInnerBlocks !== block.innerBlocks) {
  2175. if (workingBlocks === blocks) {
  2176. workingBlocks = Object(toConsumableArray["a" /* default */])(workingBlocks);
  2177. }
  2178. block = Object(objectSpread["a" /* default */])({}, block, {
  2179. innerBlocks: appliedInnerBlocks
  2180. });
  2181. workingBlocks.splice(i, 1, block);
  2182. }
  2183. case 34:
  2184. i++;
  2185. _context.next = 8;
  2186. break;
  2187. case 37:
  2188. return _context.abrupt("return", workingBlocks);
  2189. case 38:
  2190. case "end":
  2191. return _context.stop();
  2192. }
  2193. }
  2194. }, actions_marked);
  2195. }
  2196. /**
  2197. * Refreshes the last block source dependencies, optionally for a given subset
  2198. * of sources (defaults to the full set of sources).
  2199. *
  2200. * @param {?Array} sourcesToUpdate Optional subset of sources to reset.
  2201. *
  2202. * @yield {Object} Yielded actions or control descriptors.
  2203. */
  2204. function resetLastBlockSourceDependencies() {
  2205. var sourcesToUpdate,
  2206. registry,
  2207. lastBlockSourceDependencies,
  2208. _iteratorNormalCompletion,
  2209. _didIteratorError,
  2210. _iteratorError,
  2211. _iterator,
  2212. _step,
  2213. source,
  2214. dependencies,
  2215. _args2 = arguments;
  2216. return regenerator_default.a.wrap(function resetLastBlockSourceDependencies$(_context2) {
  2217. while (1) {
  2218. switch (_context2.prev = _context2.next) {
  2219. case 0:
  2220. sourcesToUpdate = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : Object.values(block_sources_namespaceObject);
  2221. if (sourcesToUpdate.length) {
  2222. _context2.next = 3;
  2223. break;
  2224. }
  2225. return _context2.abrupt("return");
  2226. case 3:
  2227. _context2.next = 5;
  2228. return getRegistry();
  2229. case 5:
  2230. registry = _context2.sent;
  2231. if (!lastBlockSourceDependenciesByRegistry.has(registry)) {
  2232. lastBlockSourceDependenciesByRegistry.set(registry, new WeakMap());
  2233. }
  2234. lastBlockSourceDependencies = lastBlockSourceDependenciesByRegistry.get(registry);
  2235. _iteratorNormalCompletion = true;
  2236. _didIteratorError = false;
  2237. _iteratorError = undefined;
  2238. _context2.prev = 11;
  2239. _iterator = sourcesToUpdate[Symbol.iterator]();
  2240. case 13:
  2241. if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
  2242. _context2.next = 21;
  2243. break;
  2244. }
  2245. source = _step.value;
  2246. return _context2.delegateYield(source.getDependencies(), "t0", 16);
  2247. case 16:
  2248. dependencies = _context2.t0;
  2249. lastBlockSourceDependencies.set(source, dependencies);
  2250. case 18:
  2251. _iteratorNormalCompletion = true;
  2252. _context2.next = 13;
  2253. break;
  2254. case 21:
  2255. _context2.next = 27;
  2256. break;
  2257. case 23:
  2258. _context2.prev = 23;
  2259. _context2.t1 = _context2["catch"](11);
  2260. _didIteratorError = true;
  2261. _iteratorError = _context2.t1;
  2262. case 27:
  2263. _context2.prev = 27;
  2264. _context2.prev = 28;
  2265. if (!_iteratorNormalCompletion && _iterator.return != null) {
  2266. _iterator.return();
  2267. }
  2268. case 30:
  2269. _context2.prev = 30;
  2270. if (!_didIteratorError) {
  2271. _context2.next = 33;
  2272. break;
  2273. }
  2274. throw _iteratorError;
  2275. case 33:
  2276. return _context2.finish(30);
  2277. case 34:
  2278. return _context2.finish(27);
  2279. case 35:
  2280. case "end":
  2281. return _context2.stop();
  2282. }
  2283. }
  2284. }, actions_marked2, null, [[11, 23, 27, 35], [28,, 30, 34]]);
  2285. }
  2286. /**
  2287. * Returns an action generator used in signalling that editor has initialized with
  2288. * the specified post object and editor settings.
  2289. *
  2290. * @param {Object} post Post object.
  2291. * @param {Object} edits Initial edited attributes object.
  2292. * @param {Array?} template Block Template.
  2293. */
  2294. function setupEditor(post, edits, template) {
  2295. var content, blocks, isNewPost;
  2296. return regenerator_default.a.wrap(function setupEditor$(_context3) {
  2297. while (1) {
  2298. switch (_context3.prev = _context3.next) {
  2299. case 0:
  2300. // In order to ensure maximum of a single parse during setup, edits are
  2301. // included as part of editor setup action. Assume edited content as
  2302. // canonical if provided, falling back to post.
  2303. if (Object(external_lodash_["has"])(edits, ['content'])) {
  2304. content = edits.content;
  2305. } else {
  2306. content = post.content.raw;
  2307. }
  2308. blocks = Object(external_this_wp_blocks_["parse"])(content); // Apply a template for new posts only, if exists.
  2309. isNewPost = post.status === 'auto-draft';
  2310. if (isNewPost && template) {
  2311. blocks = Object(external_this_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template);
  2312. }
  2313. _context3.next = 6;
  2314. return resetPost(post);
  2315. case 6:
  2316. return _context3.delegateYield(resetLastBlockSourceDependencies(), "t0", 7);
  2317. case 7:
  2318. _context3.next = 9;
  2319. return {
  2320. type: 'SETUP_EDITOR',
  2321. post: post,
  2322. edits: edits,
  2323. template: template
  2324. };
  2325. case 9:
  2326. _context3.next = 11;
  2327. return actions_resetEditorBlocks(blocks, {
  2328. __unstableShouldCreateUndoLevel: false
  2329. });
  2330. case 11:
  2331. _context3.next = 13;
  2332. return setupEditorState(post);
  2333. case 13:
  2334. if (!(edits && Object.keys(edits).some(function (key) {
  2335. return edits[key] !== (Object(external_lodash_["has"])(post, [key, 'raw']) ? post[key].raw : post[key]);
  2336. }))) {
  2337. _context3.next = 16;
  2338. break;
  2339. }
  2340. _context3.next = 16;
  2341. return actions_editPost(edits);
  2342. case 16:
  2343. return _context3.delegateYield(__experimentalSubscribeSources(), "t1", 17);
  2344. case 17:
  2345. case "end":
  2346. return _context3.stop();
  2347. }
  2348. }
  2349. }, _marked3);
  2350. }
  2351. /**
  2352. * Returns an action object signalling that the editor is being destroyed and
  2353. * that any necessary state or side-effect cleanup should occur.
  2354. *
  2355. * @return {Object} Action object.
  2356. */
  2357. function __experimentalTearDownEditor() {
  2358. return {
  2359. type: 'TEAR_DOWN_EDITOR'
  2360. };
  2361. }
  2362. /**
  2363. * Returns an action generator which loops to await the next state change,
  2364. * calling to reset blocks when a block source dependencies change.
  2365. *
  2366. * @yield {Object} Action object.
  2367. */
  2368. function __experimentalSubscribeSources() {
  2369. var isStillReady, registry, reset, _i2, _Object$values, source, dependencies, lastBlockSourceDependencies, lastDependencies;
  2370. return regenerator_default.a.wrap(function __experimentalSubscribeSources$(_context4) {
  2371. while (1) {
  2372. switch (_context4.prev = _context4.next) {
  2373. case 0:
  2374. if (false) {}
  2375. _context4.next = 3;
  2376. return awaitNextStateChange();
  2377. case 3:
  2378. _context4.next = 5;
  2379. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, '__unstableIsEditorReady');
  2380. case 5:
  2381. isStillReady = _context4.sent;
  2382. if (isStillReady) {
  2383. _context4.next = 8;
  2384. break;
  2385. }
  2386. return _context4.abrupt("break", 36);
  2387. case 8:
  2388. _context4.next = 10;
  2389. return getRegistry();
  2390. case 10:
  2391. registry = _context4.sent;
  2392. reset = false;
  2393. _i2 = 0, _Object$values = Object.values(block_sources_namespaceObject);
  2394. case 13:
  2395. if (!(_i2 < _Object$values.length)) {
  2396. _context4.next = 26;
  2397. break;
  2398. }
  2399. source = _Object$values[_i2];
  2400. if (source.getDependencies) {
  2401. _context4.next = 17;
  2402. break;
  2403. }
  2404. return _context4.abrupt("continue", 23);
  2405. case 17:
  2406. return _context4.delegateYield(source.getDependencies(), "t0", 18);
  2407. case 18:
  2408. dependencies = _context4.t0;
  2409. if (!lastBlockSourceDependenciesByRegistry.has(registry)) {
  2410. lastBlockSourceDependenciesByRegistry.set(registry, new WeakMap());
  2411. }
  2412. lastBlockSourceDependencies = lastBlockSourceDependenciesByRegistry.get(registry);
  2413. lastDependencies = lastBlockSourceDependencies.get(source);
  2414. if (!external_this_wp_isShallowEqual_default()(dependencies, lastDependencies)) {
  2415. lastBlockSourceDependencies.set(source, dependencies); // Allow the loop to continue in order to assign latest
  2416. // dependencies values, but mark for reset.
  2417. reset = true;
  2418. }
  2419. case 23:
  2420. _i2++;
  2421. _context4.next = 13;
  2422. break;
  2423. case 26:
  2424. if (!reset) {
  2425. _context4.next = 34;
  2426. break;
  2427. }
  2428. _context4.t1 = actions_resetEditorBlocks;
  2429. _context4.next = 30;
  2430. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditorBlocks');
  2431. case 30:
  2432. _context4.t2 = _context4.sent;
  2433. _context4.t3 = {
  2434. __unstableShouldCreateUndoLevel: false
  2435. };
  2436. _context4.next = 34;
  2437. return (0, _context4.t1)(_context4.t2, _context4.t3);
  2438. case 34:
  2439. _context4.next = 0;
  2440. break;
  2441. case 36:
  2442. case "end":
  2443. return _context4.stop();
  2444. }
  2445. }
  2446. }, _marked4);
  2447. }
  2448. /**
  2449. * Returns an action object used in signalling that the latest version of the
  2450. * post has been received, either by initialization or save.
  2451. *
  2452. * @param {Object} post Post object.
  2453. *
  2454. * @return {Object} Action object.
  2455. */
  2456. function resetPost(post) {
  2457. return {
  2458. type: 'RESET_POST',
  2459. post: post
  2460. };
  2461. }
  2462. /**
  2463. * Returns an action object used in signalling that the latest autosave of the
  2464. * post has been received, by initialization or autosave.
  2465. *
  2466. * @deprecated since 5.6. Callers should use the `receiveAutosaves( postId, autosave )`
  2467. * selector from the '@wordpress/core-data' package.
  2468. *
  2469. * @param {Object} newAutosave Autosave post object.
  2470. *
  2471. * @return {Object} Action object.
  2472. */
  2473. function resetAutosave(newAutosave) {
  2474. var postId;
  2475. return regenerator_default.a.wrap(function resetAutosave$(_context5) {
  2476. while (1) {
  2477. switch (_context5.prev = _context5.next) {
  2478. case 0:
  2479. external_this_wp_deprecated_default()('resetAutosave action (`core/editor` store)', {
  2480. alternative: 'receiveAutosaves action (`core` store)',
  2481. plugin: 'Gutenberg'
  2482. });
  2483. _context5.next = 3;
  2484. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPostId');
  2485. case 3:
  2486. postId = _context5.sent;
  2487. _context5.next = 6;
  2488. return Object(external_this_wp_dataControls_["dispatch"])('core', 'receiveAutosaves', postId, newAutosave);
  2489. case 6:
  2490. return _context5.abrupt("return", {
  2491. type: '__INERT__'
  2492. });
  2493. case 7:
  2494. case "end":
  2495. return _context5.stop();
  2496. }
  2497. }
  2498. }, _marked5);
  2499. }
  2500. /**
  2501. * Action for dispatching that a post update request has started.
  2502. *
  2503. * @param {Object} options
  2504. *
  2505. * @return {Object} An action object
  2506. */
  2507. function __experimentalRequestPostUpdateStart() {
  2508. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2509. return {
  2510. type: 'REQUEST_POST_UPDATE_START',
  2511. options: options
  2512. };
  2513. }
  2514. /**
  2515. * Action for dispatching that a post update request has finished.
  2516. *
  2517. * @param {Object} options
  2518. *
  2519. * @return {Object} An action object
  2520. */
  2521. function __experimentalRequestPostUpdateFinish() {
  2522. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2523. return {
  2524. type: 'REQUEST_POST_UPDATE_FINISH',
  2525. options: options
  2526. };
  2527. }
  2528. /**
  2529. * Returns an action object used in signalling that a patch of updates for the
  2530. * latest version of the post have been received.
  2531. *
  2532. * @param {Object} edits Updated post fields.
  2533. *
  2534. * @return {Object} Action object.
  2535. */
  2536. function updatePost(edits) {
  2537. return {
  2538. type: 'UPDATE_POST',
  2539. edits: edits
  2540. };
  2541. }
  2542. /**
  2543. * Returns an action object used to setup the editor state when first opening
  2544. * an editor.
  2545. *
  2546. * @param {Object} post Post object.
  2547. *
  2548. * @return {Object} Action object.
  2549. */
  2550. function setupEditorState(post) {
  2551. return {
  2552. type: 'SETUP_EDITOR_STATE',
  2553. post: post
  2554. };
  2555. }
  2556. /**
  2557. * Returns an action object used in signalling that attributes of the post have
  2558. * been edited.
  2559. *
  2560. * @param {Object} edits Post attributes to edit.
  2561. * @param {Object} options Options for the edit.
  2562. *
  2563. * @yield {Object} Action object or control.
  2564. */
  2565. function actions_editPost(edits, options) {
  2566. var _ref, id, type;
  2567. return regenerator_default.a.wrap(function editPost$(_context6) {
  2568. while (1) {
  2569. switch (_context6.prev = _context6.next) {
  2570. case 0:
  2571. _context6.next = 2;
  2572. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost');
  2573. case 2:
  2574. _ref = _context6.sent;
  2575. id = _ref.id;
  2576. type = _ref.type;
  2577. _context6.next = 7;
  2578. return Object(external_this_wp_dataControls_["dispatch"])('core', 'editEntityRecord', 'postType', type, id, edits, options);
  2579. case 7:
  2580. case "end":
  2581. return _context6.stop();
  2582. }
  2583. }
  2584. }, _marked6);
  2585. }
  2586. /**
  2587. * Returns action object produced by the updatePost creator augmented by
  2588. * an optimist option that signals optimistically applying updates.
  2589. *
  2590. * @param {Object} edits Updated post fields.
  2591. *
  2592. * @return {Object} Action object.
  2593. */
  2594. function __experimentalOptimisticUpdatePost(edits) {
  2595. return Object(objectSpread["a" /* default */])({}, updatePost(edits), {
  2596. optimist: {
  2597. id: POST_UPDATE_TRANSACTION_ID
  2598. }
  2599. });
  2600. }
  2601. /**
  2602. * Action generator for saving the current post in the editor.
  2603. *
  2604. * @param {Object} options
  2605. */
  2606. function savePost() {
  2607. var options,
  2608. edits,
  2609. previousRecord,
  2610. error,
  2611. args,
  2612. updatedRecord,
  2613. _args7,
  2614. _args8 = arguments;
  2615. return regenerator_default.a.wrap(function savePost$(_context7) {
  2616. while (1) {
  2617. switch (_context7.prev = _context7.next) {
  2618. case 0:
  2619. options = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
  2620. _context7.next = 3;
  2621. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'isEditedPostSaveable');
  2622. case 3:
  2623. if (_context7.sent) {
  2624. _context7.next = 5;
  2625. break;
  2626. }
  2627. return _context7.abrupt("return");
  2628. case 5:
  2629. _context7.next = 7;
  2630. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostContent');
  2631. case 7:
  2632. _context7.t0 = _context7.sent;
  2633. edits = {
  2634. content: _context7.t0
  2635. };
  2636. if (options.isAutosave) {
  2637. _context7.next = 12;
  2638. break;
  2639. }
  2640. _context7.next = 12;
  2641. return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'editPost', edits, {
  2642. undoIgnore: true
  2643. });
  2644. case 12:
  2645. _context7.next = 14;
  2646. return __experimentalRequestPostUpdateStart(options);
  2647. case 14:
  2648. _context7.next = 16;
  2649. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost');
  2650. case 16:
  2651. previousRecord = _context7.sent;
  2652. _context7.t1 = objectSpread["a" /* default */];
  2653. _context7.t2 = {
  2654. id: previousRecord.id
  2655. };
  2656. _context7.next = 21;
  2657. return Object(external_this_wp_dataControls_["select"])('core', 'getEntityRecordNonTransientEdits', 'postType', previousRecord.type, previousRecord.id);
  2658. case 21:
  2659. _context7.t3 = _context7.sent;
  2660. _context7.t4 = edits;
  2661. edits = (0, _context7.t1)(_context7.t2, _context7.t3, _context7.t4);
  2662. _context7.next = 26;
  2663. return Object(external_this_wp_dataControls_["dispatch"])('core', 'saveEntityRecord', 'postType', previousRecord.type, edits, options);
  2664. case 26:
  2665. _context7.next = 28;
  2666. return __experimentalRequestPostUpdateFinish(options);
  2667. case 28:
  2668. _context7.next = 30;
  2669. return Object(external_this_wp_dataControls_["select"])('core', 'getLastEntitySaveError', 'postType', previousRecord.type, previousRecord.id);
  2670. case 30:
  2671. error = _context7.sent;
  2672. if (!error) {
  2673. _context7.next = 38;
  2674. break;
  2675. }
  2676. args = getNotificationArgumentsForSaveFail({
  2677. post: previousRecord,
  2678. edits: edits,
  2679. error: error
  2680. });
  2681. if (!args.length) {
  2682. _context7.next = 36;
  2683. break;
  2684. }
  2685. _context7.next = 36;
  2686. return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/notices', 'createErrorNotice'].concat(Object(toConsumableArray["a" /* default */])(args)));
  2687. case 36:
  2688. _context7.next = 56;
  2689. break;
  2690. case 38:
  2691. _context7.next = 40;
  2692. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost');
  2693. case 40:
  2694. updatedRecord = _context7.sent;
  2695. _context7.t5 = getNotificationArgumentsForSaveSuccess;
  2696. _context7.t6 = previousRecord;
  2697. _context7.t7 = updatedRecord;
  2698. _context7.next = 46;
  2699. return Object(external_this_wp_dataControls_["select"])('core', 'getPostType', updatedRecord.type);
  2700. case 46:
  2701. _context7.t8 = _context7.sent;
  2702. _context7.t9 = options;
  2703. _context7.t10 = {
  2704. previousPost: _context7.t6,
  2705. post: _context7.t7,
  2706. postType: _context7.t8,
  2707. options: _context7.t9
  2708. };
  2709. _args7 = (0, _context7.t5)(_context7.t10);
  2710. if (!_args7.length) {
  2711. _context7.next = 53;
  2712. break;
  2713. }
  2714. _context7.next = 53;
  2715. return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/notices', 'createSuccessNotice'].concat(Object(toConsumableArray["a" /* default */])(_args7)));
  2716. case 53:
  2717. if (options.isAutosave) {
  2718. _context7.next = 56;
  2719. break;
  2720. }
  2721. _context7.next = 56;
  2722. return Object(external_this_wp_dataControls_["dispatch"])('core/block-editor', '__unstableMarkLastChangeAsPersistent');
  2723. case 56:
  2724. case "end":
  2725. return _context7.stop();
  2726. }
  2727. }
  2728. }, _marked7);
  2729. }
  2730. /**
  2731. * Action generator for handling refreshing the current post.
  2732. */
  2733. function refreshPost() {
  2734. var post, postTypeSlug, postType, newPost;
  2735. return regenerator_default.a.wrap(function refreshPost$(_context8) {
  2736. while (1) {
  2737. switch (_context8.prev = _context8.next) {
  2738. case 0:
  2739. _context8.next = 2;
  2740. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost');
  2741. case 2:
  2742. post = _context8.sent;
  2743. _context8.next = 5;
  2744. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPostType');
  2745. case 5:
  2746. postTypeSlug = _context8.sent;
  2747. _context8.next = 8;
  2748. return Object(external_this_wp_dataControls_["select"])('core', 'getPostType', postTypeSlug);
  2749. case 8:
  2750. postType = _context8.sent;
  2751. _context8.next = 11;
  2752. return Object(external_this_wp_dataControls_["apiFetch"])({
  2753. // Timestamp arg allows caller to bypass browser caching, which is
  2754. // expected for this specific function.
  2755. path: "/wp/v2/".concat(postType.rest_base, "/").concat(post.id) + "?context=edit&_timestamp=".concat(Date.now())
  2756. });
  2757. case 11:
  2758. newPost = _context8.sent;
  2759. _context8.next = 14;
  2760. return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'resetPost', newPost);
  2761. case 14:
  2762. case "end":
  2763. return _context8.stop();
  2764. }
  2765. }
  2766. }, _marked8);
  2767. }
  2768. /**
  2769. * Action generator for trashing the current post in the editor.
  2770. */
  2771. function trashPost() {
  2772. var postTypeSlug, postType, post;
  2773. return regenerator_default.a.wrap(function trashPost$(_context9) {
  2774. while (1) {
  2775. switch (_context9.prev = _context9.next) {
  2776. case 0:
  2777. _context9.next = 2;
  2778. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPostType');
  2779. case 2:
  2780. postTypeSlug = _context9.sent;
  2781. _context9.next = 5;
  2782. return Object(external_this_wp_dataControls_["select"])('core', 'getPostType', postTypeSlug);
  2783. case 5:
  2784. postType = _context9.sent;
  2785. _context9.next = 8;
  2786. return Object(external_this_wp_dataControls_["dispatch"])('core/notices', 'removeNotice', TRASH_POST_NOTICE_ID);
  2787. case 8:
  2788. _context9.prev = 8;
  2789. _context9.next = 11;
  2790. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost');
  2791. case 11:
  2792. post = _context9.sent;
  2793. _context9.next = 14;
  2794. return Object(external_this_wp_dataControls_["apiFetch"])({
  2795. path: "/wp/v2/".concat(postType.rest_base, "/").concat(post.id),
  2796. method: 'DELETE'
  2797. });
  2798. case 14:
  2799. _context9.next = 16;
  2800. return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'savePost');
  2801. case 16:
  2802. _context9.next = 22;
  2803. break;
  2804. case 18:
  2805. _context9.prev = 18;
  2806. _context9.t0 = _context9["catch"](8);
  2807. _context9.next = 22;
  2808. return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/notices', 'createErrorNotice'].concat(Object(toConsumableArray["a" /* default */])(getNotificationArgumentsForTrashFail({
  2809. error: _context9.t0
  2810. }))));
  2811. case 22:
  2812. case "end":
  2813. return _context9.stop();
  2814. }
  2815. }
  2816. }, _marked9, null, [[8, 18]]);
  2817. }
  2818. /**
  2819. * Action generator used in signalling that the post should autosave.
  2820. *
  2821. * @param {Object?} options Extra flags to identify the autosave.
  2822. */
  2823. function actions_autosave(options) {
  2824. return regenerator_default.a.wrap(function autosave$(_context10) {
  2825. while (1) {
  2826. switch (_context10.prev = _context10.next) {
  2827. case 0:
  2828. _context10.next = 2;
  2829. return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'savePost', Object(objectSpread["a" /* default */])({
  2830. isAutosave: true
  2831. }, options));
  2832. case 2:
  2833. case "end":
  2834. return _context10.stop();
  2835. }
  2836. }
  2837. }, _marked10);
  2838. }
  2839. function actions_experimentalLocalAutosave() {
  2840. var post, title, content, excerpt;
  2841. return regenerator_default.a.wrap(function __experimentalLocalAutosave$(_context11) {
  2842. while (1) {
  2843. switch (_context11.prev = _context11.next) {
  2844. case 0:
  2845. _context11.next = 2;
  2846. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost');
  2847. case 2:
  2848. post = _context11.sent;
  2849. _context11.next = 5;
  2850. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostAttribute', 'title');
  2851. case 5:
  2852. title = _context11.sent;
  2853. _context11.next = 8;
  2854. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostAttribute', 'content');
  2855. case 8:
  2856. content = _context11.sent;
  2857. _context11.next = 11;
  2858. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostAttribute', 'excerpt');
  2859. case 11:
  2860. excerpt = _context11.sent;
  2861. _context11.next = 14;
  2862. return {
  2863. type: 'LOCAL_AUTOSAVE_SET',
  2864. postId: post.id,
  2865. title: title,
  2866. content: content,
  2867. excerpt: excerpt
  2868. };
  2869. case 14:
  2870. case "end":
  2871. return _context11.stop();
  2872. }
  2873. }
  2874. }, _marked11);
  2875. }
  2876. /**
  2877. * Returns an action object used in signalling that undo history should
  2878. * restore last popped state.
  2879. *
  2880. * @yield {Object} Action object.
  2881. */
  2882. function actions_redo() {
  2883. return regenerator_default.a.wrap(function redo$(_context12) {
  2884. while (1) {
  2885. switch (_context12.prev = _context12.next) {
  2886. case 0:
  2887. _context12.next = 2;
  2888. return Object(external_this_wp_dataControls_["dispatch"])('core', 'redo');
  2889. case 2:
  2890. case "end":
  2891. return _context12.stop();
  2892. }
  2893. }
  2894. }, _marked12);
  2895. }
  2896. /**
  2897. * Returns an action object used in signalling that undo history should pop.
  2898. *
  2899. * @yield {Object} Action object.
  2900. */
  2901. function actions_undo() {
  2902. return regenerator_default.a.wrap(function undo$(_context13) {
  2903. while (1) {
  2904. switch (_context13.prev = _context13.next) {
  2905. case 0:
  2906. _context13.next = 2;
  2907. return Object(external_this_wp_dataControls_["dispatch"])('core', 'undo');
  2908. case 2:
  2909. case "end":
  2910. return _context13.stop();
  2911. }
  2912. }
  2913. }, _marked13);
  2914. }
  2915. /**
  2916. * Returns an action object used in signalling that undo history record should
  2917. * be created.
  2918. *
  2919. * @return {Object} Action object.
  2920. */
  2921. function createUndoLevel() {
  2922. return {
  2923. type: 'CREATE_UNDO_LEVEL'
  2924. };
  2925. }
  2926. /**
  2927. * Returns an action object used to lock the editor.
  2928. *
  2929. * @param {Object} lock Details about the post lock status, user, and nonce.
  2930. *
  2931. * @return {Object} Action object.
  2932. */
  2933. function updatePostLock(lock) {
  2934. return {
  2935. type: 'UPDATE_POST_LOCK',
  2936. lock: lock
  2937. };
  2938. }
  2939. /**
  2940. * Returns an action object used to fetch a single reusable block or all
  2941. * reusable blocks from the REST API into the store.
  2942. *
  2943. * @param {?string} id If given, only a single reusable block with this ID will
  2944. * be fetched.
  2945. *
  2946. * @return {Object} Action object.
  2947. */
  2948. function __experimentalFetchReusableBlocks(id) {
  2949. return {
  2950. type: 'FETCH_REUSABLE_BLOCKS',
  2951. id: id
  2952. };
  2953. }
  2954. /**
  2955. * Returns an action object used in signalling that reusable blocks have been
  2956. * received. `results` is an array of objects containing:
  2957. * - `reusableBlock` - Details about how the reusable block is persisted.
  2958. * - `parsedBlock` - The original block.
  2959. *
  2960. * @param {Object[]} results Reusable blocks received.
  2961. *
  2962. * @return {Object} Action object.
  2963. */
  2964. function __experimentalReceiveReusableBlocks(results) {
  2965. return {
  2966. type: 'RECEIVE_REUSABLE_BLOCKS',
  2967. results: results
  2968. };
  2969. }
  2970. /**
  2971. * Returns an action object used to save a reusable block that's in the store to
  2972. * the REST API.
  2973. *
  2974. * @param {Object} id The ID of the reusable block to save.
  2975. *
  2976. * @return {Object} Action object.
  2977. */
  2978. function __experimentalSaveReusableBlock(id) {
  2979. return {
  2980. type: 'SAVE_REUSABLE_BLOCK',
  2981. id: id
  2982. };
  2983. }
  2984. /**
  2985. * Returns an action object used to delete a reusable block via the REST API.
  2986. *
  2987. * @param {number} id The ID of the reusable block to delete.
  2988. *
  2989. * @return {Object} Action object.
  2990. */
  2991. function __experimentalDeleteReusableBlock(id) {
  2992. return {
  2993. type: 'DELETE_REUSABLE_BLOCK',
  2994. id: id
  2995. };
  2996. }
  2997. /**
  2998. * Returns an action object used in signalling that a reusable block is
  2999. * to be updated.
  3000. *
  3001. * @param {number} id The ID of the reusable block to update.
  3002. * @param {Object} changes The changes to apply.
  3003. *
  3004. * @return {Object} Action object.
  3005. */
  3006. function __experimentalUpdateReusableBlock(id, changes) {
  3007. return {
  3008. type: 'UPDATE_REUSABLE_BLOCK',
  3009. id: id,
  3010. changes: changes
  3011. };
  3012. }
  3013. /**
  3014. * Returns an action object used to convert a reusable block into a static
  3015. * block.
  3016. *
  3017. * @param {string} clientId The client ID of the block to attach.
  3018. *
  3019. * @return {Object} Action object.
  3020. */
  3021. function __experimentalConvertBlockToStatic(clientId) {
  3022. return {
  3023. type: 'CONVERT_BLOCK_TO_STATIC',
  3024. clientId: clientId
  3025. };
  3026. }
  3027. /**
  3028. * Returns an action object used to convert a static block into a reusable
  3029. * block.
  3030. *
  3031. * @param {string} clientIds The client IDs of the block to detach.
  3032. *
  3033. * @return {Object} Action object.
  3034. */
  3035. function __experimentalConvertBlockToReusable(clientIds) {
  3036. return {
  3037. type: 'CONVERT_BLOCK_TO_REUSABLE',
  3038. clientIds: Object(external_lodash_["castArray"])(clientIds)
  3039. };
  3040. }
  3041. /**
  3042. * Returns an action object used in signalling that the user has enabled the
  3043. * publish sidebar.
  3044. *
  3045. * @return {Object} Action object
  3046. */
  3047. function enablePublishSidebar() {
  3048. return {
  3049. type: 'ENABLE_PUBLISH_SIDEBAR'
  3050. };
  3051. }
  3052. /**
  3053. * Returns an action object used in signalling that the user has disabled the
  3054. * publish sidebar.
  3055. *
  3056. * @return {Object} Action object
  3057. */
  3058. function disablePublishSidebar() {
  3059. return {
  3060. type: 'DISABLE_PUBLISH_SIDEBAR'
  3061. };
  3062. }
  3063. /**
  3064. * Returns an action object used to signal that post saving is locked.
  3065. *
  3066. * @param {string} lockName The lock name.
  3067. *
  3068. * @example
  3069. * ```
  3070. * const { subscribe } = wp.data;
  3071. *
  3072. * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
  3073. *
  3074. * // Only allow publishing posts that are set to a future date.
  3075. * if ( 'publish' !== initialPostStatus ) {
  3076. *
  3077. * // Track locking.
  3078. * let locked = false;
  3079. *
  3080. * // Watch for the publish event.
  3081. * let unssubscribe = subscribe( () => {
  3082. * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
  3083. * if ( 'publish' !== currentPostStatus ) {
  3084. *
  3085. * // Compare the post date to the current date, lock the post if the date isn't in the future.
  3086. * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );
  3087. * const currentDate = new Date();
  3088. * if ( postDate.getTime() <= currentDate.getTime() ) {
  3089. * if ( ! locked ) {
  3090. * locked = true;
  3091. * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );
  3092. * }
  3093. * } else {
  3094. * if ( locked ) {
  3095. * locked = false;
  3096. * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );
  3097. * }
  3098. * }
  3099. * }
  3100. * } );
  3101. * }
  3102. * ```
  3103. *
  3104. * @return {Object} Action object
  3105. */
  3106. function lockPostSaving(lockName) {
  3107. return {
  3108. type: 'LOCK_POST_SAVING',
  3109. lockName: lockName
  3110. };
  3111. }
  3112. /**
  3113. * Returns an action object used to signal that post saving is unlocked.
  3114. *
  3115. * @param {string} lockName The lock name.
  3116. *
  3117. * @example
  3118. * ```
  3119. * // Unlock post saving with the lock key `mylock`:
  3120. * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );
  3121. * ```
  3122. *
  3123. * @return {Object} Action object
  3124. */
  3125. function unlockPostSaving(lockName) {
  3126. return {
  3127. type: 'UNLOCK_POST_SAVING',
  3128. lockName: lockName
  3129. };
  3130. }
  3131. /**
  3132. * Returns an action object used to signal that the blocks have been updated.
  3133. *
  3134. * @param {Array} blocks Block Array.
  3135. * @param {?Object} options Optional options.
  3136. *
  3137. * @yield {Object} Action object
  3138. */
  3139. function actions_resetEditorBlocks(blocks) {
  3140. var options,
  3141. lastBlockAttributesChange,
  3142. updatedSources,
  3143. updatedBlockTypes,
  3144. _i3,
  3145. _Object$entries2,
  3146. _Object$entries2$_i,
  3147. clientId,
  3148. attributes,
  3149. blockName,
  3150. blockType,
  3151. _i4,
  3152. _Object$entries3,
  3153. _Object$entries3$_i,
  3154. attributeName,
  3155. newAttributeValue,
  3156. schema,
  3157. source,
  3158. edits,
  3159. _ref2,
  3160. id,
  3161. type,
  3162. noChange,
  3163. _args15 = arguments;
  3164. return regenerator_default.a.wrap(function resetEditorBlocks$(_context14) {
  3165. while (1) {
  3166. switch (_context14.prev = _context14.next) {
  3167. case 0:
  3168. options = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
  3169. _context14.next = 3;
  3170. return Object(external_this_wp_dataControls_["select"])('core/block-editor', '__experimentalGetLastBlockAttributeChanges');
  3171. case 3:
  3172. lastBlockAttributesChange = _context14.sent;
  3173. if (!lastBlockAttributesChange) {
  3174. _context14.next = 36;
  3175. break;
  3176. }
  3177. updatedSources = new Set();
  3178. updatedBlockTypes = new Set();
  3179. _i3 = 0, _Object$entries2 = Object.entries(lastBlockAttributesChange);
  3180. case 8:
  3181. if (!(_i3 < _Object$entries2.length)) {
  3182. _context14.next = 35;
  3183. break;
  3184. }
  3185. _Object$entries2$_i = Object(slicedToArray["a" /* default */])(_Object$entries2[_i3], 2), clientId = _Object$entries2$_i[0], attributes = _Object$entries2$_i[1];
  3186. _context14.next = 12;
  3187. return Object(external_this_wp_dataControls_["select"])('core/block-editor', 'getBlockName', clientId);
  3188. case 12:
  3189. blockName = _context14.sent;
  3190. if (!updatedBlockTypes.has(blockName)) {
  3191. _context14.next = 15;
  3192. break;
  3193. }
  3194. return _context14.abrupt("continue", 32);
  3195. case 15:
  3196. updatedBlockTypes.add(blockName);
  3197. _context14.next = 18;
  3198. return Object(external_this_wp_dataControls_["select"])('core/blocks', 'getBlockType', blockName);
  3199. case 18:
  3200. blockType = _context14.sent;
  3201. _i4 = 0, _Object$entries3 = Object.entries(attributes);
  3202. case 20:
  3203. if (!(_i4 < _Object$entries3.length)) {
  3204. _context14.next = 32;
  3205. break;
  3206. }
  3207. _Object$entries3$_i = Object(slicedToArray["a" /* default */])(_Object$entries3[_i4], 2), attributeName = _Object$entries3$_i[0], newAttributeValue = _Object$entries3$_i[1];
  3208. if (blockType.attributes.hasOwnProperty(attributeName)) {
  3209. _context14.next = 24;
  3210. break;
  3211. }
  3212. return _context14.abrupt("continue", 29);
  3213. case 24:
  3214. schema = blockType.attributes[attributeName];
  3215. source = block_sources_namespaceObject[schema.source];
  3216. if (!(source && source.update)) {
  3217. _context14.next = 29;
  3218. break;
  3219. }
  3220. return _context14.delegateYield(source.update(schema, newAttributeValue), "t0", 28);
  3221. case 28:
  3222. updatedSources.add(source);
  3223. case 29:
  3224. _i4++;
  3225. _context14.next = 20;
  3226. break;
  3227. case 32:
  3228. _i3++;
  3229. _context14.next = 8;
  3230. break;
  3231. case 35:
  3232. return _context14.delegateYield(resetLastBlockSourceDependencies(Array.from(updatedSources)), "t1", 36);
  3233. case 36:
  3234. return _context14.delegateYield(getBlocksWithSourcedAttributes(blocks), "t2", 37);
  3235. case 37:
  3236. _context14.t3 = _context14.t2;
  3237. edits = {
  3238. blocks: _context14.t3
  3239. };
  3240. if (!(options.__unstableShouldCreateUndoLevel !== false)) {
  3241. _context14.next = 55;
  3242. break;
  3243. }
  3244. _context14.next = 42;
  3245. return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost');
  3246. case 42:
  3247. _ref2 = _context14.sent;
  3248. id = _ref2.id;
  3249. type = _ref2.type;
  3250. _context14.next = 47;
  3251. return Object(external_this_wp_dataControls_["select"])('core', 'getEditedEntityRecord', 'postType', type, id);
  3252. case 47:
  3253. _context14.t4 = _context14.sent.blocks;
  3254. _context14.t5 = edits.blocks;
  3255. noChange = _context14.t4 === _context14.t5;
  3256. if (!noChange) {
  3257. _context14.next = 54;
  3258. break;
  3259. }
  3260. _context14.next = 53;
  3261. return Object(external_this_wp_dataControls_["dispatch"])('core', '__unstableCreateUndoLevel', 'postType', type, id);
  3262. case 53:
  3263. return _context14.abrupt("return", _context14.sent);
  3264. case 54:
  3265. // We create a new function here on every persistent edit
  3266. // to make sure the edit makes the post dirty and creates
  3267. // a new undo level.
  3268. edits.content = function (_ref3) {
  3269. var _ref3$blocks = _ref3.blocks,
  3270. blocksForSerialization = _ref3$blocks === void 0 ? [] : _ref3$blocks;
  3271. return serialize_blocks(blocksForSerialization);
  3272. };
  3273. case 55:
  3274. return _context14.delegateYield(actions_editPost(edits), "t6", 56);
  3275. case 56:
  3276. case "end":
  3277. return _context14.stop();
  3278. }
  3279. }
  3280. }, _marked14);
  3281. }
  3282. /*
  3283. * Returns an action object used in signalling that the post editor settings have been updated.
  3284. *
  3285. * @param {Object} settings Updated settings
  3286. *
  3287. * @return {Object} Action object
  3288. */
  3289. function updateEditorSettings(settings) {
  3290. return {
  3291. type: 'UPDATE_EDITOR_SETTINGS',
  3292. settings: settings
  3293. };
  3294. }
  3295. /**
  3296. * Backward compatibility
  3297. */
  3298. var actions_getBlockEditorAction = function getBlockEditorAction(name) {
  3299. return (
  3300. /*#__PURE__*/
  3301. regenerator_default.a.mark(function _callee() {
  3302. var _len,
  3303. args,
  3304. _key,
  3305. _args16 = arguments;
  3306. return regenerator_default.a.wrap(function _callee$(_context15) {
  3307. while (1) {
  3308. switch (_context15.prev = _context15.next) {
  3309. case 0:
  3310. external_this_wp_deprecated_default()('`wp.data.dispatch( \'core/editor\' ).' + name + '`', {
  3311. alternative: '`wp.data.dispatch( \'core/block-editor\' ).' + name + '`'
  3312. });
  3313. for (_len = _args16.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  3314. args[_key] = _args16[_key];
  3315. }
  3316. _context15.next = 4;
  3317. return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/block-editor', name].concat(args));
  3318. case 4:
  3319. case "end":
  3320. return _context15.stop();
  3321. }
  3322. }
  3323. }, _callee);
  3324. })
  3325. );
  3326. };
  3327. /**
  3328. * @see resetBlocks in core/block-editor store.
  3329. */
  3330. var resetBlocks = actions_getBlockEditorAction('resetBlocks');
  3331. /**
  3332. * @see receiveBlocks in core/block-editor store.
  3333. */
  3334. var receiveBlocks = actions_getBlockEditorAction('receiveBlocks');
  3335. /**
  3336. * @see updateBlock in core/block-editor store.
  3337. */
  3338. var updateBlock = actions_getBlockEditorAction('updateBlock');
  3339. /**
  3340. * @see updateBlockAttributes in core/block-editor store.
  3341. */
  3342. var updateBlockAttributes = actions_getBlockEditorAction('updateBlockAttributes');
  3343. /**
  3344. * @see selectBlock in core/block-editor store.
  3345. */
  3346. var selectBlock = actions_getBlockEditorAction('selectBlock');
  3347. /**
  3348. * @see startMultiSelect in core/block-editor store.
  3349. */
  3350. var startMultiSelect = actions_getBlockEditorAction('startMultiSelect');
  3351. /**
  3352. * @see stopMultiSelect in core/block-editor store.
  3353. */
  3354. var stopMultiSelect = actions_getBlockEditorAction('stopMultiSelect');
  3355. /**
  3356. * @see multiSelect in core/block-editor store.
  3357. */
  3358. var multiSelect = actions_getBlockEditorAction('multiSelect');
  3359. /**
  3360. * @see clearSelectedBlock in core/block-editor store.
  3361. */
  3362. var clearSelectedBlock = actions_getBlockEditorAction('clearSelectedBlock');
  3363. /**
  3364. * @see toggleSelection in core/block-editor store.
  3365. */
  3366. var toggleSelection = actions_getBlockEditorAction('toggleSelection');
  3367. /**
  3368. * @see replaceBlocks in core/block-editor store.
  3369. */
  3370. var actions_replaceBlocks = actions_getBlockEditorAction('replaceBlocks');
  3371. /**
  3372. * @see replaceBlock in core/block-editor store.
  3373. */
  3374. var replaceBlock = actions_getBlockEditorAction('replaceBlock');
  3375. /**
  3376. * @see moveBlocksDown in core/block-editor store.
  3377. */
  3378. var moveBlocksDown = actions_getBlockEditorAction('moveBlocksDown');
  3379. /**
  3380. * @see moveBlocksUp in core/block-editor store.
  3381. */
  3382. var moveBlocksUp = actions_getBlockEditorAction('moveBlocksUp');
  3383. /**
  3384. * @see moveBlockToPosition in core/block-editor store.
  3385. */
  3386. var moveBlockToPosition = actions_getBlockEditorAction('moveBlockToPosition');
  3387. /**
  3388. * @see insertBlock in core/block-editor store.
  3389. */
  3390. var insertBlock = actions_getBlockEditorAction('insertBlock');
  3391. /**
  3392. * @see insertBlocks in core/block-editor store.
  3393. */
  3394. var insertBlocks = actions_getBlockEditorAction('insertBlocks');
  3395. /**
  3396. * @see showInsertionPoint in core/block-editor store.
  3397. */
  3398. var showInsertionPoint = actions_getBlockEditorAction('showInsertionPoint');
  3399. /**
  3400. * @see hideInsertionPoint in core/block-editor store.
  3401. */
  3402. var hideInsertionPoint = actions_getBlockEditorAction('hideInsertionPoint');
  3403. /**
  3404. * @see setTemplateValidity in core/block-editor store.
  3405. */
  3406. var setTemplateValidity = actions_getBlockEditorAction('setTemplateValidity');
  3407. /**
  3408. * @see synchronizeTemplate in core/block-editor store.
  3409. */
  3410. var synchronizeTemplate = actions_getBlockEditorAction('synchronizeTemplate');
  3411. /**
  3412. * @see mergeBlocks in core/block-editor store.
  3413. */
  3414. var mergeBlocks = actions_getBlockEditorAction('mergeBlocks');
  3415. /**
  3416. * @see removeBlocks in core/block-editor store.
  3417. */
  3418. var actions_removeBlocks = actions_getBlockEditorAction('removeBlocks');
  3419. /**
  3420. * @see removeBlock in core/block-editor store.
  3421. */
  3422. var removeBlock = actions_getBlockEditorAction('removeBlock');
  3423. /**
  3424. * @see toggleBlockMode in core/block-editor store.
  3425. */
  3426. var toggleBlockMode = actions_getBlockEditorAction('toggleBlockMode');
  3427. /**
  3428. * @see startTyping in core/block-editor store.
  3429. */
  3430. var startTyping = actions_getBlockEditorAction('startTyping');
  3431. /**
  3432. * @see stopTyping in core/block-editor store.
  3433. */
  3434. var stopTyping = actions_getBlockEditorAction('stopTyping');
  3435. /**
  3436. * @see enterFormattedText in core/block-editor store.
  3437. */
  3438. var enterFormattedText = actions_getBlockEditorAction('enterFormattedText');
  3439. /**
  3440. * @see exitFormattedText in core/block-editor store.
  3441. */
  3442. var exitFormattedText = actions_getBlockEditorAction('exitFormattedText');
  3443. /**
  3444. * @see insertDefaultBlock in core/block-editor store.
  3445. */
  3446. var insertDefaultBlock = actions_getBlockEditorAction('insertDefaultBlock');
  3447. /**
  3448. * @see updateBlockListSettings in core/block-editor store.
  3449. */
  3450. var updateBlockListSettings = actions_getBlockEditorAction('updateBlockListSettings');
  3451. // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
  3452. var rememo = __webpack_require__(36);
  3453. // EXTERNAL MODULE: external {"this":["wp","date"]}
  3454. var external_this_wp_date_ = __webpack_require__(53);
  3455. // EXTERNAL MODULE: external {"this":["wp","url"]}
  3456. var external_this_wp_url_ = __webpack_require__(26);
  3457. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js
  3458. /**
  3459. * External dependencies
  3460. */
  3461. /**
  3462. * WordPress dependencies
  3463. */
  3464. /**
  3465. * Internal dependencies
  3466. */
  3467. /**
  3468. * Shared reference to an empty object for cases where it is important to avoid
  3469. * returning a new object reference on every invocation, as in a connected or
  3470. * other pure component which performs `shouldComponentUpdate` check on props.
  3471. * This should be used as a last resort, since the normalized data should be
  3472. * maintained by the reducer result in state.
  3473. */
  3474. var EMPTY_OBJECT = {};
  3475. /**
  3476. * Shared reference to an empty array for cases where it is important to avoid
  3477. * returning a new array reference on every invocation, as in a connected or
  3478. * other pure component which performs `shouldComponentUpdate` check on props.
  3479. * This should be used as a last resort, since the normalized data should be
  3480. * maintained by the reducer result in state.
  3481. */
  3482. var EMPTY_ARRAY = [];
  3483. /**
  3484. * Returns true if any past editor history snapshots exist, or false otherwise.
  3485. *
  3486. * @param {Object} state Global application state.
  3487. *
  3488. * @return {boolean} Whether undo history exists.
  3489. */
  3490. var hasEditorUndo = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  3491. return function () {
  3492. return select('core').hasUndo();
  3493. };
  3494. });
  3495. /**
  3496. * Returns true if any future editor history snapshots exist, or false
  3497. * otherwise.
  3498. *
  3499. * @param {Object} state Global application state.
  3500. *
  3501. * @return {boolean} Whether redo history exists.
  3502. */
  3503. var hasEditorRedo = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  3504. return function () {
  3505. return select('core').hasRedo();
  3506. };
  3507. });
  3508. /**
  3509. * Returns true if the currently edited post is yet to be saved, or false if
  3510. * the post has been saved.
  3511. *
  3512. * @param {Object} state Global application state.
  3513. *
  3514. * @return {boolean} Whether the post is new.
  3515. */
  3516. function selectors_isEditedPostNew(state) {
  3517. return selectors_getCurrentPost(state).status === 'auto-draft';
  3518. }
  3519. /**
  3520. * Returns true if content includes unsaved changes, or false otherwise.
  3521. *
  3522. * @param {Object} state Editor state.
  3523. *
  3524. * @return {boolean} Whether content includes unsaved changes.
  3525. */
  3526. function hasChangedContent(state) {
  3527. var edits = getPostEdits(state);
  3528. return 'blocks' in edits || // `edits` is intended to contain only values which are different from
  3529. // the saved post, so the mere presence of a property is an indicator
  3530. // that the value is different than what is known to be saved. While
  3531. // content in Visual mode is represented by the blocks state, in Text
  3532. // mode it is tracked by `edits.content`.
  3533. 'content' in edits;
  3534. }
  3535. /**
  3536. * Returns true if there are unsaved values for the current edit session, or
  3537. * false if the editing state matches the saved or new post.
  3538. *
  3539. * @param {Object} state Global application state.
  3540. *
  3541. * @return {boolean} Whether unsaved values exist.
  3542. */
  3543. var selectors_isEditedPostDirty = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  3544. return function (state) {
  3545. // Edits should contain only fields which differ from the saved post (reset
  3546. // at initial load and save complete). Thus, a non-empty edits state can be
  3547. // inferred to contain unsaved values.
  3548. var postType = selectors_getCurrentPostType(state);
  3549. var postId = selectors_getCurrentPostId(state);
  3550. if (select('core').hasEditsForEntityRecord('postType', postType, postId)) {
  3551. return true;
  3552. }
  3553. return false;
  3554. };
  3555. });
  3556. /**
  3557. * Returns true if there are no unsaved values for the current edit session and
  3558. * if the currently edited post is new (has never been saved before).
  3559. *
  3560. * @param {Object} state Global application state.
  3561. *
  3562. * @return {boolean} Whether new post and unsaved values exist.
  3563. */
  3564. function selectors_isCleanNewPost(state) {
  3565. return !selectors_isEditedPostDirty(state) && selectors_isEditedPostNew(state);
  3566. }
  3567. /**
  3568. * Returns the post currently being edited in its last known saved state, not
  3569. * including unsaved edits. Returns an object containing relevant default post
  3570. * values if the post has not yet been saved.
  3571. *
  3572. * @param {Object} state Global application state.
  3573. *
  3574. * @return {Object} Post object.
  3575. */
  3576. var selectors_getCurrentPost = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  3577. return function (state) {
  3578. var postId = selectors_getCurrentPostId(state);
  3579. var postType = selectors_getCurrentPostType(state);
  3580. var post = select('core').getRawEntityRecord('postType', postType, postId);
  3581. if (post) {
  3582. return post;
  3583. } // This exists for compatibility with the previous selector behavior
  3584. // which would guarantee an object return based on the editor reducer's
  3585. // default empty object state.
  3586. return EMPTY_OBJECT;
  3587. };
  3588. });
  3589. /**
  3590. * Returns the post type of the post currently being edited.
  3591. *
  3592. * @param {Object} state Global application state.
  3593. *
  3594. * @return {string} Post type.
  3595. */
  3596. function selectors_getCurrentPostType(state) {
  3597. return state.postType;
  3598. }
  3599. /**
  3600. * Returns the ID of the post currently being edited, or null if the post has
  3601. * not yet been saved.
  3602. *
  3603. * @param {Object} state Global application state.
  3604. *
  3605. * @return {?number} ID of current post.
  3606. */
  3607. function selectors_getCurrentPostId(state) {
  3608. return state.postId;
  3609. }
  3610. /**
  3611. * Returns the number of revisions of the post currently being edited.
  3612. *
  3613. * @param {Object} state Global application state.
  3614. *
  3615. * @return {number} Number of revisions.
  3616. */
  3617. function getCurrentPostRevisionsCount(state) {
  3618. return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0);
  3619. }
  3620. /**
  3621. * Returns the last revision ID of the post currently being edited,
  3622. * or null if the post has no revisions.
  3623. *
  3624. * @param {Object} state Global application state.
  3625. *
  3626. * @return {?number} ID of the last revision.
  3627. */
  3628. function getCurrentPostLastRevisionId(state) {
  3629. return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null);
  3630. }
  3631. /**
  3632. * Returns any post values which have been changed in the editor but not yet
  3633. * been saved.
  3634. *
  3635. * @param {Object} state Global application state.
  3636. *
  3637. * @return {Object} Object of key value pairs comprising unsaved edits.
  3638. */
  3639. var getPostEdits = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  3640. return function (state) {
  3641. var postType = selectors_getCurrentPostType(state);
  3642. var postId = selectors_getCurrentPostId(state);
  3643. return select('core').getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT;
  3644. };
  3645. });
  3646. /**
  3647. * Returns an attribute value of the saved post.
  3648. *
  3649. * @param {Object} state Global application state.
  3650. * @param {string} attributeName Post attribute name.
  3651. *
  3652. * @return {*} Post attribute value.
  3653. */
  3654. function selectors_getCurrentPostAttribute(state, attributeName) {
  3655. switch (attributeName) {
  3656. case 'type':
  3657. return selectors_getCurrentPostType(state);
  3658. case 'id':
  3659. return selectors_getCurrentPostId(state);
  3660. default:
  3661. var post = selectors_getCurrentPost(state);
  3662. if (!post.hasOwnProperty(attributeName)) {
  3663. break;
  3664. }
  3665. return getPostRawValue(post[attributeName]);
  3666. }
  3667. }
  3668. /**
  3669. * Returns a single attribute of the post being edited, preferring the unsaved
  3670. * edit if one exists, but merging with the attribute value for the last known
  3671. * saved state of the post (this is needed for some nested attributes like meta).
  3672. *
  3673. * @param {Object} state Global application state.
  3674. * @param {string} attributeName Post attribute name.
  3675. *
  3676. * @return {*} Post attribute value.
  3677. */
  3678. var selectors_getNestedEditedPostProperty = function getNestedEditedPostProperty(state, attributeName) {
  3679. var edits = getPostEdits(state);
  3680. if (!edits.hasOwnProperty(attributeName)) {
  3681. return selectors_getCurrentPostAttribute(state, attributeName);
  3682. }
  3683. return Object(objectSpread["a" /* default */])({}, selectors_getCurrentPostAttribute(state, attributeName), edits[attributeName]);
  3684. };
  3685. /**
  3686. * Returns a single attribute of the post being edited, preferring the unsaved
  3687. * edit if one exists, but falling back to the attribute for the last known
  3688. * saved state of the post.
  3689. *
  3690. * @param {Object} state Global application state.
  3691. * @param {string} attributeName Post attribute name.
  3692. *
  3693. * @return {*} Post attribute value.
  3694. */
  3695. function selectors_getEditedPostAttribute(state, attributeName) {
  3696. // Special cases
  3697. switch (attributeName) {
  3698. case 'content':
  3699. return getEditedPostContent(state);
  3700. } // Fall back to saved post value if not edited.
  3701. var edits = getPostEdits(state);
  3702. if (!edits.hasOwnProperty(attributeName)) {
  3703. return selectors_getCurrentPostAttribute(state, attributeName);
  3704. } // Merge properties are objects which contain only the patch edit in state,
  3705. // and thus must be merged with the current post attribute.
  3706. if (EDIT_MERGE_PROPERTIES.has(attributeName)) {
  3707. return selectors_getNestedEditedPostProperty(state, attributeName);
  3708. }
  3709. return edits[attributeName];
  3710. }
  3711. /**
  3712. * Returns an attribute value of the current autosave revision for a post, or
  3713. * null if there is no autosave for the post.
  3714. *
  3715. * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
  3716. * from the '@wordpress/core-data' package and access properties on the returned
  3717. * autosave object using getPostRawValue.
  3718. *
  3719. * @param {Object} state Global application state.
  3720. * @param {string} attributeName Autosave attribute name.
  3721. *
  3722. * @return {*} Autosave attribute value.
  3723. */
  3724. var getAutosaveAttribute = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  3725. return function (state, attributeName) {
  3726. if (!Object(external_lodash_["includes"])(AUTOSAVE_PROPERTIES, attributeName) && attributeName !== 'preview_link') {
  3727. return;
  3728. }
  3729. var postType = selectors_getCurrentPostType(state);
  3730. var postId = selectors_getCurrentPostId(state);
  3731. var currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']);
  3732. var autosave = select('core').getAutosave(postType, postId, currentUserId);
  3733. if (autosave) {
  3734. return getPostRawValue(autosave[attributeName]);
  3735. }
  3736. };
  3737. });
  3738. /**
  3739. * Returns the current visibility of the post being edited, preferring the
  3740. * unsaved value if different than the saved post. The return value is one of
  3741. * "private", "password", or "public".
  3742. *
  3743. * @param {Object} state Global application state.
  3744. *
  3745. * @return {string} Post visibility.
  3746. */
  3747. function selectors_getEditedPostVisibility(state) {
  3748. var status = selectors_getEditedPostAttribute(state, 'status');
  3749. if (status === 'private') {
  3750. return 'private';
  3751. }
  3752. var password = selectors_getEditedPostAttribute(state, 'password');
  3753. if (password) {
  3754. return 'password';
  3755. }
  3756. return 'public';
  3757. }
  3758. /**
  3759. * Returns true if post is pending review.
  3760. *
  3761. * @param {Object} state Global application state.
  3762. *
  3763. * @return {boolean} Whether current post is pending review.
  3764. */
  3765. function isCurrentPostPending(state) {
  3766. return selectors_getCurrentPost(state).status === 'pending';
  3767. }
  3768. /**
  3769. * Return true if the current post has already been published.
  3770. *
  3771. * @param {Object} state Global application state.
  3772. * @param {Object?} currentPost Explicit current post for bypassing registry selector.
  3773. *
  3774. * @return {boolean} Whether the post has been published.
  3775. */
  3776. function selectors_isCurrentPostPublished(state, currentPost) {
  3777. var post = currentPost || selectors_getCurrentPost(state);
  3778. return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !Object(external_this_wp_date_["isInTheFuture"])(new Date(Number(Object(external_this_wp_date_["getDate"])(post.date)) - ONE_MINUTE_IN_MS));
  3779. }
  3780. /**
  3781. * Returns true if post is already scheduled.
  3782. *
  3783. * @param {Object} state Global application state.
  3784. *
  3785. * @return {boolean} Whether current post is scheduled to be posted.
  3786. */
  3787. function selectors_isCurrentPostScheduled(state) {
  3788. return selectors_getCurrentPost(state).status === 'future' && !selectors_isCurrentPostPublished(state);
  3789. }
  3790. /**
  3791. * Return true if the post being edited can be published.
  3792. *
  3793. * @param {Object} state Global application state.
  3794. *
  3795. * @return {boolean} Whether the post can been published.
  3796. */
  3797. function selectors_isEditedPostPublishable(state) {
  3798. var post = selectors_getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post
  3799. // being saveable. Currently this restriction is imposed at UI.
  3800. //
  3801. // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`)
  3802. return selectors_isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1;
  3803. }
  3804. /**
  3805. * Returns true if the post can be saved, or false otherwise. A post must
  3806. * contain a title, an excerpt, or non-empty content to be valid for save.
  3807. *
  3808. * @param {Object} state Global application state.
  3809. *
  3810. * @return {boolean} Whether the post can be saved.
  3811. */
  3812. function selectors_isEditedPostSaveable(state) {
  3813. if (selectors_isSavingPost(state)) {
  3814. return false;
  3815. } // TODO: Post should not be saveable if not dirty. Cannot be added here at
  3816. // this time since posts where meta boxes are present can be saved even if
  3817. // the post is not dirty. Currently this restriction is imposed at UI, but
  3818. // should be moved here.
  3819. //
  3820. // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition)
  3821. // See: <PostSavedState /> (`forceIsDirty` prop)
  3822. // See: <PostPublishButton /> (`forceIsDirty` prop)
  3823. // See: https://github.com/WordPress/gutenberg/pull/4184
  3824. return !!selectors_getEditedPostAttribute(state, 'title') || !!selectors_getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state);
  3825. }
  3826. /**
  3827. * Returns true if the edited post has content. A post has content if it has at
  3828. * least one saveable block or otherwise has a non-empty content property
  3829. * assigned.
  3830. *
  3831. * @param {Object} state Global application state.
  3832. *
  3833. * @return {boolean} Whether post has content.
  3834. */
  3835. function isEditedPostEmpty(state) {
  3836. // While the condition of truthy content string is sufficient to determine
  3837. // emptiness, testing saveable blocks length is a trivial operation. Since
  3838. // this function can be called frequently, optimize for the fast case as a
  3839. // condition of the mere existence of blocks. Note that the value of edited
  3840. // content takes precedent over block content, and must fall through to the
  3841. // default logic.
  3842. var blocks = selectors_getEditorBlocks(state);
  3843. if (blocks.length) {
  3844. // Pierce the abstraction of the serializer in knowing that blocks are
  3845. // joined with with newlines such that even if every individual block
  3846. // produces an empty save result, the serialized content is non-empty.
  3847. if (blocks.length > 1) {
  3848. return false;
  3849. } // There are two conditions under which the optimization cannot be
  3850. // assumed, and a fallthrough to getEditedPostContent must occur:
  3851. //
  3852. // 1. getBlocksForSerialization has special treatment in omitting a
  3853. // single unmodified default block.
  3854. // 2. Comment delimiters are omitted for a freeform or unregistered
  3855. // block in its serialization. The freeform block specifically may
  3856. // produce an empty string in its saved output.
  3857. //
  3858. // For all other content, the single block is assumed to make a post
  3859. // non-empty, if only by virtue of its own comment delimiters.
  3860. var blockName = blocks[0].name;
  3861. if (blockName !== Object(external_this_wp_blocks_["getDefaultBlockName"])() && blockName !== Object(external_this_wp_blocks_["getFreeformContentHandlerName"])()) {
  3862. return false;
  3863. }
  3864. }
  3865. return !getEditedPostContent(state);
  3866. }
  3867. /**
  3868. * Returns true if the post can be autosaved, or false otherwise.
  3869. *
  3870. * @param {Object} state Global application state.
  3871. * @param {Object} autosave A raw autosave object from the REST API.
  3872. *
  3873. * @return {boolean} Whether the post can be autosaved.
  3874. */
  3875. var selectors_isEditedPostAutosaveable = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  3876. return function (state) {
  3877. // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
  3878. if (!selectors_isEditedPostSaveable(state)) {
  3879. return false;
  3880. } // A post is not autosavable when there is a post autosave lock.
  3881. if (isPostAutosavingLocked(state)) {
  3882. return false;
  3883. }
  3884. var postType = selectors_getCurrentPostType(state);
  3885. var postId = selectors_getCurrentPostId(state);
  3886. var hasFetchedAutosave = select('core').hasFetchedAutosaves(postType, postId);
  3887. var currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); // Disable reason - this line causes the side-effect of fetching the autosave
  3888. // via a resolver, moving below the return would result in the autosave never
  3889. // being fetched.
  3890. // eslint-disable-next-line @wordpress/no-unused-vars-before-return
  3891. var autosave = select('core').getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is
  3892. // unable to determine if the post is autosaveable, so return false.
  3893. if (!hasFetchedAutosave) {
  3894. return false;
  3895. } // If we don't already have an autosave, the post is autosaveable.
  3896. if (!autosave) {
  3897. return true;
  3898. } // To avoid an expensive content serialization, use the content dirtiness
  3899. // flag in place of content field comparison against the known autosave.
  3900. // This is not strictly accurate, and relies on a tolerance toward autosave
  3901. // request failures for unnecessary saves.
  3902. if (hasChangedContent(state)) {
  3903. return true;
  3904. } // If the title or excerpt has changed, the post is autosaveable.
  3905. return ['title', 'excerpt'].some(function (field) {
  3906. return getPostRawValue(autosave[field]) !== selectors_getEditedPostAttribute(state, field);
  3907. });
  3908. };
  3909. });
  3910. /**
  3911. * Returns the current autosave, or null if one is not set (i.e. if the post
  3912. * has yet to be autosaved, or has been saved or published since the last
  3913. * autosave).
  3914. *
  3915. * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )`
  3916. * selector from the '@wordpress/core-data' package.
  3917. *
  3918. * @param {Object} state Editor state.
  3919. *
  3920. * @return {?Object} Current autosave, if exists.
  3921. */
  3922. var getAutosave = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  3923. return function (state) {
  3924. external_this_wp_deprecated_default()('`wp.data.select( \'core/editor\' ).getAutosave()`', {
  3925. alternative: '`wp.data.select( \'core\' ).getAutosave( postType, postId, userId )`',
  3926. plugin: 'Gutenberg'
  3927. });
  3928. var postType = selectors_getCurrentPostType(state);
  3929. var postId = selectors_getCurrentPostId(state);
  3930. var currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']);
  3931. var autosave = select('core').getAutosave(postType, postId, currentUserId);
  3932. return Object(external_lodash_["mapValues"])(Object(external_lodash_["pick"])(autosave, AUTOSAVE_PROPERTIES), getPostRawValue);
  3933. };
  3934. });
  3935. /**
  3936. * Returns the true if there is an existing autosave, otherwise false.
  3937. *
  3938. * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
  3939. * from the '@wordpress/core-data' package and check for a truthy value.
  3940. *
  3941. * @param {Object} state Global application state.
  3942. *
  3943. * @return {boolean} Whether there is an existing autosave.
  3944. */
  3945. var hasAutosave = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  3946. return function (state) {
  3947. external_this_wp_deprecated_default()('`wp.data.select( \'core/editor\' ).hasAutosave()`', {
  3948. alternative: '`!! wp.data.select( \'core\' ).getAutosave( postType, postId, userId )`',
  3949. plugin: 'Gutenberg'
  3950. });
  3951. var postType = selectors_getCurrentPostType(state);
  3952. var postId = selectors_getCurrentPostId(state);
  3953. var currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']);
  3954. return !!select('core').getAutosave(postType, postId, currentUserId);
  3955. };
  3956. });
  3957. /**
  3958. * Return true if the post being edited is being scheduled. Preferring the
  3959. * unsaved status values.
  3960. *
  3961. * @param {Object} state Global application state.
  3962. *
  3963. * @return {boolean} Whether the post has been published.
  3964. */
  3965. function selectors_isEditedPostBeingScheduled(state) {
  3966. var date = selectors_getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency)
  3967. var checkedDate = new Date(Number(Object(external_this_wp_date_["getDate"])(date)) - ONE_MINUTE_IN_MS);
  3968. return Object(external_this_wp_date_["isInTheFuture"])(checkedDate);
  3969. }
  3970. /**
  3971. * Returns whether the current post should be considered to have a "floating"
  3972. * date (i.e. that it would publish "Immediately" rather than at a set time).
  3973. *
  3974. * Unlike in the PHP backend, the REST API returns a full date string for posts
  3975. * where the 0000-00-00T00:00:00 placeholder is present in the database. To
  3976. * infer that a post is set to publish "Immediately" we check whether the date
  3977. * and modified date are the same.
  3978. *
  3979. * @param {Object} state Editor state.
  3980. *
  3981. * @return {boolean} Whether the edited post has a floating date value.
  3982. */
  3983. function isEditedPostDateFloating(state) {
  3984. var date = selectors_getEditedPostAttribute(state, 'date');
  3985. var modified = selectors_getEditedPostAttribute(state, 'modified');
  3986. var status = selectors_getEditedPostAttribute(state, 'status');
  3987. if (status === 'draft' || status === 'auto-draft' || status === 'pending') {
  3988. return date === modified;
  3989. }
  3990. return false;
  3991. }
  3992. /**
  3993. * Returns true if the post is currently being saved, or false otherwise.
  3994. *
  3995. * @param {Object} state Global application state.
  3996. *
  3997. * @return {boolean} Whether post is being saved.
  3998. */
  3999. var selectors_isSavingPost = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  4000. return function (state) {
  4001. var postType = selectors_getCurrentPostType(state);
  4002. var postId = selectors_getCurrentPostId(state);
  4003. return select('core').isSavingEntityRecord('postType', postType, postId);
  4004. };
  4005. });
  4006. /**
  4007. * Returns true if a previous post save was attempted successfully, or false
  4008. * otherwise.
  4009. *
  4010. * @param {Object} state Global application state.
  4011. *
  4012. * @return {boolean} Whether the post was saved successfully.
  4013. */
  4014. var didPostSaveRequestSucceed = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  4015. return function (state) {
  4016. var postType = selectors_getCurrentPostType(state);
  4017. var postId = selectors_getCurrentPostId(state);
  4018. return !select('core').getLastEntitySaveError('postType', postType, postId);
  4019. };
  4020. });
  4021. /**
  4022. * Returns true if a previous post save was attempted but failed, or false
  4023. * otherwise.
  4024. *
  4025. * @param {Object} state Global application state.
  4026. *
  4027. * @return {boolean} Whether the post save failed.
  4028. */
  4029. var didPostSaveRequestFail = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  4030. return function (state) {
  4031. var postType = selectors_getCurrentPostType(state);
  4032. var postId = selectors_getCurrentPostId(state);
  4033. return !!select('core').getLastEntitySaveError('postType', postType, postId);
  4034. };
  4035. });
  4036. /**
  4037. * Returns true if the post is autosaving, or false otherwise.
  4038. *
  4039. * @param {Object} state Global application state.
  4040. *
  4041. * @return {boolean} Whether the post is autosaving.
  4042. */
  4043. function selectors_isAutosavingPost(state) {
  4044. if (!selectors_isSavingPost(state)) {
  4045. return false;
  4046. }
  4047. return !!Object(external_lodash_["get"])(state.saving, ['options', 'isAutosave']);
  4048. }
  4049. /**
  4050. * Returns true if the post is being previewed, or false otherwise.
  4051. *
  4052. * @param {Object} state Global application state.
  4053. *
  4054. * @return {boolean} Whether the post is being previewed.
  4055. */
  4056. function isPreviewingPost(state) {
  4057. if (!selectors_isSavingPost(state)) {
  4058. return false;
  4059. }
  4060. return !!state.saving.options.isPreview;
  4061. }
  4062. /**
  4063. * Returns the post preview link
  4064. *
  4065. * @param {Object} state Global application state.
  4066. *
  4067. * @return {string?} Preview Link.
  4068. */
  4069. function selectors_getEditedPostPreviewLink(state) {
  4070. if (state.saving.pending || selectors_isSavingPost(state)) {
  4071. return;
  4072. }
  4073. var previewLink = getAutosaveAttribute(state, 'preview_link');
  4074. if (!previewLink) {
  4075. previewLink = selectors_getEditedPostAttribute(state, 'link');
  4076. if (previewLink) {
  4077. previewLink = Object(external_this_wp_url_["addQueryArgs"])(previewLink, {
  4078. preview: true
  4079. });
  4080. }
  4081. }
  4082. var featuredImageId = selectors_getEditedPostAttribute(state, 'featured_media');
  4083. if (previewLink && featuredImageId) {
  4084. return Object(external_this_wp_url_["addQueryArgs"])(previewLink, {
  4085. _thumbnail_id: featuredImageId
  4086. });
  4087. }
  4088. return previewLink;
  4089. }
  4090. /**
  4091. * Returns a suggested post format for the current post, inferred only if there
  4092. * is a single block within the post and it is of a type known to match a
  4093. * default post format. Returns null if the format cannot be determined.
  4094. *
  4095. * @param {Object} state Global application state.
  4096. *
  4097. * @return {?string} Suggested post format.
  4098. */
  4099. function selectors_getSuggestedPostFormat(state) {
  4100. var blocks = selectors_getEditorBlocks(state);
  4101. var name; // If there is only one block in the content of the post grab its name
  4102. // so we can derive a suitable post format from it.
  4103. if (blocks.length === 1) {
  4104. name = blocks[0].name;
  4105. } // If there are two blocks in the content and the last one is a text blocks
  4106. // grab the name of the first one to also suggest a post format from it.
  4107. if (blocks.length === 2) {
  4108. if (blocks[1].name === 'core/paragraph') {
  4109. name = blocks[0].name;
  4110. }
  4111. } // We only convert to default post formats in core.
  4112. switch (name) {
  4113. case 'core/image':
  4114. return 'image';
  4115. case 'core/quote':
  4116. case 'core/pullquote':
  4117. return 'quote';
  4118. case 'core/gallery':
  4119. return 'gallery';
  4120. case 'core/video':
  4121. case 'core-embed/youtube':
  4122. case 'core-embed/vimeo':
  4123. return 'video';
  4124. case 'core/audio':
  4125. case 'core-embed/spotify':
  4126. case 'core-embed/soundcloud':
  4127. return 'audio';
  4128. }
  4129. return null;
  4130. }
  4131. /**
  4132. * Returns a set of blocks which are to be used in consideration of the post's
  4133. * generated save content.
  4134. *
  4135. * @deprecated since Gutenberg 6.2.0.
  4136. *
  4137. * @param {Object} state Editor state.
  4138. *
  4139. * @return {WPBlock[]} Filtered set of blocks for save.
  4140. */
  4141. function getBlocksForSerialization(state) {
  4142. external_this_wp_deprecated_default()('`core/editor` getBlocksForSerialization selector', {
  4143. plugin: 'Gutenberg',
  4144. alternative: 'getEditorBlocks',
  4145. hint: 'Blocks serialization pre-processing occurs at save time'
  4146. });
  4147. var blocks = state.editor.present.blocks.value; // WARNING: Any changes to the logic of this function should be verified
  4148. // against the implementation of isEditedPostEmpty, which bypasses this
  4149. // function for performance' sake, in an assumption of this current logic
  4150. // being irrelevant to the optimized condition of emptiness.
  4151. // A single unmodified default block is assumed to be equivalent to an
  4152. // empty post.
  4153. var isSingleUnmodifiedDefaultBlock = blocks.length === 1 && Object(external_this_wp_blocks_["isUnmodifiedDefaultBlock"])(blocks[0]);
  4154. if (isSingleUnmodifiedDefaultBlock) {
  4155. return [];
  4156. }
  4157. return blocks;
  4158. }
  4159. /**
  4160. * Returns the content of the post being edited.
  4161. *
  4162. * @param {Object} state Global application state.
  4163. *
  4164. * @return {string} Post content.
  4165. */
  4166. var getEditedPostContent = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  4167. return function (state) {
  4168. var postId = selectors_getCurrentPostId(state);
  4169. var postType = selectors_getCurrentPostType(state);
  4170. var record = select('core').getEditedEntityRecord('postType', postType, postId);
  4171. if (record) {
  4172. if (typeof record.content === 'function') {
  4173. return record.content(record);
  4174. } else if (record.blocks) {
  4175. return serialize_blocks(record.blocks);
  4176. } else if (record.content) {
  4177. return record.content;
  4178. }
  4179. }
  4180. return '';
  4181. };
  4182. });
  4183. /**
  4184. * Returns the reusable block with the given ID.
  4185. *
  4186. * @param {Object} state Global application state.
  4187. * @param {number|string} ref The reusable block's ID.
  4188. *
  4189. * @return {Object} The reusable block, or null if none exists.
  4190. */
  4191. var __experimentalGetReusableBlock = Object(rememo["a" /* default */])(function (state, ref) {
  4192. var block = state.reusableBlocks.data[ref];
  4193. if (!block) {
  4194. return null;
  4195. }
  4196. var isTemporary = isNaN(parseInt(ref));
  4197. return Object(objectSpread["a" /* default */])({}, block, {
  4198. id: isTemporary ? ref : +ref,
  4199. isTemporary: isTemporary
  4200. });
  4201. }, function (state, ref) {
  4202. return [state.reusableBlocks.data[ref]];
  4203. });
  4204. /**
  4205. * Returns whether or not the reusable block with the given ID is being saved.
  4206. *
  4207. * @param {Object} state Global application state.
  4208. * @param {string} ref The reusable block's ID.
  4209. *
  4210. * @return {boolean} Whether or not the reusable block is being saved.
  4211. */
  4212. function __experimentalIsSavingReusableBlock(state, ref) {
  4213. return state.reusableBlocks.isSaving[ref] || false;
  4214. }
  4215. /**
  4216. * Returns true if the reusable block with the given ID is being fetched, or
  4217. * false otherwise.
  4218. *
  4219. * @param {Object} state Global application state.
  4220. * @param {string} ref The reusable block's ID.
  4221. *
  4222. * @return {boolean} Whether the reusable block is being fetched.
  4223. */
  4224. function __experimentalIsFetchingReusableBlock(state, ref) {
  4225. return !!state.reusableBlocks.isFetching[ref];
  4226. }
  4227. /**
  4228. * Returns an array of all reusable blocks.
  4229. *
  4230. * @param {Object} state Global application state.
  4231. *
  4232. * @return {Array} An array of all reusable blocks.
  4233. */
  4234. var selectors_experimentalGetReusableBlocks = Object(rememo["a" /* default */])(function (state) {
  4235. return Object(external_lodash_["map"])(state.reusableBlocks.data, function (value, ref) {
  4236. return __experimentalGetReusableBlock(state, ref);
  4237. });
  4238. }, function (state) {
  4239. return [state.reusableBlocks.data];
  4240. });
  4241. /**
  4242. * Returns state object prior to a specified optimist transaction ID, or `null`
  4243. * if the transaction corresponding to the given ID cannot be found.
  4244. *
  4245. * @param {Object} state Current global application state.
  4246. * @param {Object} transactionId Optimist transaction ID.
  4247. *
  4248. * @return {Object} Global application state prior to transaction.
  4249. */
  4250. function getStateBeforeOptimisticTransaction(state, transactionId) {
  4251. var transaction = Object(external_lodash_["find"])(state.optimist, function (entry) {
  4252. return entry.beforeState && Object(external_lodash_["get"])(entry.action, ['optimist', 'id']) === transactionId;
  4253. });
  4254. return transaction ? transaction.beforeState : null;
  4255. }
  4256. /**
  4257. * Returns true if the post is being published, or false otherwise.
  4258. *
  4259. * @param {Object} state Global application state.
  4260. *
  4261. * @return {boolean} Whether post is being published.
  4262. */
  4263. function selectors_isPublishingPost(state) {
  4264. if (!selectors_isSavingPost(state)) {
  4265. return false;
  4266. } // Saving is optimistic, so assume that current post would be marked as
  4267. // published if publishing
  4268. if (!selectors_isCurrentPostPublished(state)) {
  4269. return false;
  4270. } // Use post update transaction ID to retrieve the state prior to the
  4271. // optimistic transaction
  4272. var stateBeforeRequest = getStateBeforeOptimisticTransaction(state, POST_UPDATE_TRANSACTION_ID); // Consider as publishing when current post prior to request was not
  4273. // considered published
  4274. return !!stateBeforeRequest && !selectors_isCurrentPostPublished(null, stateBeforeRequest.currentPost);
  4275. }
  4276. /**
  4277. * Returns whether the permalink is editable or not.
  4278. *
  4279. * @param {Object} state Editor state.
  4280. *
  4281. * @return {boolean} Whether or not the permalink is editable.
  4282. */
  4283. function selectors_isPermalinkEditable(state) {
  4284. var permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template');
  4285. return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate);
  4286. }
  4287. /**
  4288. * Returns the permalink for the post.
  4289. *
  4290. * @param {Object} state Editor state.
  4291. *
  4292. * @return {?string} The permalink, or null if the post is not viewable.
  4293. */
  4294. function getPermalink(state) {
  4295. var permalinkParts = selectors_getPermalinkParts(state);
  4296. if (!permalinkParts) {
  4297. return null;
  4298. }
  4299. var prefix = permalinkParts.prefix,
  4300. postName = permalinkParts.postName,
  4301. suffix = permalinkParts.suffix;
  4302. if (selectors_isPermalinkEditable(state)) {
  4303. return prefix + postName + suffix;
  4304. }
  4305. return prefix;
  4306. }
  4307. /**
  4308. * Returns the permalink for a post, split into it's three parts: the prefix,
  4309. * the postName, and the suffix.
  4310. *
  4311. * @param {Object} state Editor state.
  4312. *
  4313. * @return {Object} An object containing the prefix, postName, and suffix for
  4314. * the permalink, or null if the post is not viewable.
  4315. */
  4316. function selectors_getPermalinkParts(state) {
  4317. var permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template');
  4318. if (!permalinkTemplate) {
  4319. return null;
  4320. }
  4321. var postName = selectors_getEditedPostAttribute(state, 'slug') || selectors_getEditedPostAttribute(state, 'generated_slug');
  4322. var _permalinkTemplate$sp = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX),
  4323. _permalinkTemplate$sp2 = Object(slicedToArray["a" /* default */])(_permalinkTemplate$sp, 2),
  4324. prefix = _permalinkTemplate$sp2[0],
  4325. suffix = _permalinkTemplate$sp2[1];
  4326. return {
  4327. prefix: prefix,
  4328. postName: postName,
  4329. suffix: suffix
  4330. };
  4331. }
  4332. /**
  4333. * Returns true if an optimistic transaction is pending commit, for which the
  4334. * before state satisfies the given predicate function.
  4335. *
  4336. * @param {Object} state Editor state.
  4337. * @param {Function} predicate Function given state, returning true if match.
  4338. *
  4339. * @return {boolean} Whether predicate matches for some history.
  4340. */
  4341. function inSomeHistory(state, predicate) {
  4342. var optimist = state.optimist; // In recursion, optimist state won't exist. Assume exhausted options.
  4343. if (!optimist) {
  4344. return false;
  4345. }
  4346. return optimist.some(function (_ref) {
  4347. var beforeState = _ref.beforeState;
  4348. return beforeState && predicate(beforeState);
  4349. });
  4350. }
  4351. /**
  4352. * Returns whether the post is locked.
  4353. *
  4354. * @param {Object} state Global application state.
  4355. *
  4356. * @return {boolean} Is locked.
  4357. */
  4358. function isPostLocked(state) {
  4359. return state.postLock.isLocked;
  4360. }
  4361. /**
  4362. * Returns whether post saving is locked.
  4363. *
  4364. * @param {Object} state Global application state.
  4365. *
  4366. * @return {boolean} Is locked.
  4367. */
  4368. function selectors_isPostSavingLocked(state) {
  4369. return Object.keys(state.postSavingLock).length > 0;
  4370. }
  4371. /**
  4372. * Returns whether post autosaving is locked.
  4373. *
  4374. * @param {Object} state Global application state.
  4375. *
  4376. * @return {boolean} Is locked.
  4377. */
  4378. function isPostAutosavingLocked(state) {
  4379. return Object.keys(state.postAutosavingLock).length > 0;
  4380. }
  4381. /**
  4382. * Returns whether the edition of the post has been taken over.
  4383. *
  4384. * @param {Object} state Global application state.
  4385. *
  4386. * @return {boolean} Is post lock takeover.
  4387. */
  4388. function isPostLockTakeover(state) {
  4389. return state.postLock.isTakeover;
  4390. }
  4391. /**
  4392. * Returns details about the post lock user.
  4393. *
  4394. * @param {Object} state Global application state.
  4395. *
  4396. * @return {Object} A user object.
  4397. */
  4398. function getPostLockUser(state) {
  4399. return state.postLock.user;
  4400. }
  4401. /**
  4402. * Returns the active post lock.
  4403. *
  4404. * @param {Object} state Global application state.
  4405. *
  4406. * @return {Object} The lock object.
  4407. */
  4408. function getActivePostLock(state) {
  4409. return state.postLock.activePostLock;
  4410. }
  4411. /**
  4412. * Returns whether or not the user has the unfiltered_html capability.
  4413. *
  4414. * @param {Object} state Editor state.
  4415. *
  4416. * @return {boolean} Whether the user can or can't post unfiltered HTML.
  4417. */
  4418. function selectors_canUserUseUnfilteredHTML(state) {
  4419. return Object(external_lodash_["has"])(selectors_getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']);
  4420. }
  4421. /**
  4422. * Returns whether the pre-publish panel should be shown
  4423. * or skipped when the user clicks the "publish" button.
  4424. *
  4425. * @param {Object} state Global application state.
  4426. *
  4427. * @return {boolean} Whether the pre-publish panel should be shown or not.
  4428. */
  4429. function selectors_isPublishSidebarEnabled(state) {
  4430. if (state.preferences.hasOwnProperty('isPublishSidebarEnabled')) {
  4431. return state.preferences.isPublishSidebarEnabled;
  4432. }
  4433. return PREFERENCES_DEFAULTS.isPublishSidebarEnabled;
  4434. }
  4435. /**
  4436. * Return the current block list.
  4437. *
  4438. * @param {Object} state
  4439. * @return {Array} Block list.
  4440. */
  4441. function selectors_getEditorBlocks(state) {
  4442. return selectors_getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY;
  4443. }
  4444. /**
  4445. * Is the editor ready
  4446. *
  4447. * @param {Object} state
  4448. * @return {boolean} is Ready.
  4449. */
  4450. function __unstableIsEditorReady(state) {
  4451. return state.isReady;
  4452. }
  4453. /**
  4454. * Returns the post editor settings.
  4455. *
  4456. * @param {Object} state Editor state.
  4457. *
  4458. * @return {Object} The editor settings object.
  4459. */
  4460. function selectors_getEditorSettings(state) {
  4461. return state.editorSettings;
  4462. }
  4463. /*
  4464. * Backward compatibility
  4465. */
  4466. function getBlockEditorSelector(name) {
  4467. return Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
  4468. return function (state) {
  4469. var _select;
  4470. external_this_wp_deprecated_default()('`wp.data.select( \'core/editor\' ).' + name + '`', {
  4471. alternative: '`wp.data.select( \'core/block-editor\' ).' + name + '`'
  4472. });
  4473. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  4474. args[_key - 1] = arguments[_key];
  4475. }
  4476. return (_select = select('core/block-editor'))[name].apply(_select, args);
  4477. };
  4478. });
  4479. }
  4480. /**
  4481. * @see getBlockName in core/block-editor store.
  4482. */
  4483. var selectors_getBlockName = getBlockEditorSelector('getBlockName');
  4484. /**
  4485. * @see isBlockValid in core/block-editor store.
  4486. */
  4487. var isBlockValid = getBlockEditorSelector('isBlockValid');
  4488. /**
  4489. * @see getBlockAttributes in core/block-editor store.
  4490. */
  4491. var getBlockAttributes = getBlockEditorSelector('getBlockAttributes');
  4492. /**
  4493. * @see getBlock in core/block-editor store.
  4494. */
  4495. var selectors_getBlock = getBlockEditorSelector('getBlock');
  4496. /**
  4497. * @see getBlocks in core/block-editor store.
  4498. */
  4499. var selectors_getBlocks = getBlockEditorSelector('getBlocks');
  4500. /**
  4501. * @see __unstableGetBlockWithoutInnerBlocks in core/block-editor store.
  4502. */
  4503. var __unstableGetBlockWithoutInnerBlocks = getBlockEditorSelector('__unstableGetBlockWithoutInnerBlocks');
  4504. /**
  4505. * @see getClientIdsOfDescendants in core/block-editor store.
  4506. */
  4507. var getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants');
  4508. /**
  4509. * @see getClientIdsWithDescendants in core/block-editor store.
  4510. */
  4511. var getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants');
  4512. /**
  4513. * @see getGlobalBlockCount in core/block-editor store.
  4514. */
  4515. var getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount');
  4516. /**
  4517. * @see getBlocksByClientId in core/block-editor store.
  4518. */
  4519. var selectors_getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId');
  4520. /**
  4521. * @see getBlockCount in core/block-editor store.
  4522. */
  4523. var getBlockCount = getBlockEditorSelector('getBlockCount');
  4524. /**
  4525. * @see getBlockSelectionStart in core/block-editor store.
  4526. */
  4527. var getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart');
  4528. /**
  4529. * @see getBlockSelectionEnd in core/block-editor store.
  4530. */
  4531. var getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd');
  4532. /**
  4533. * @see getSelectedBlockCount in core/block-editor store.
  4534. */
  4535. var getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount');
  4536. /**
  4537. * @see hasSelectedBlock in core/block-editor store.
  4538. */
  4539. var hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock');
  4540. /**
  4541. * @see getSelectedBlockClientId in core/block-editor store.
  4542. */
  4543. var selectors_getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId');
  4544. /**
  4545. * @see getSelectedBlock in core/block-editor store.
  4546. */
  4547. var getSelectedBlock = getBlockEditorSelector('getSelectedBlock');
  4548. /**
  4549. * @see getBlockRootClientId in core/block-editor store.
  4550. */
  4551. var getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId');
  4552. /**
  4553. * @see getBlockHierarchyRootClientId in core/block-editor store.
  4554. */
  4555. var getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId');
  4556. /**
  4557. * @see getAdjacentBlockClientId in core/block-editor store.
  4558. */
  4559. var getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId');
  4560. /**
  4561. * @see getPreviousBlockClientId in core/block-editor store.
  4562. */
  4563. var getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId');
  4564. /**
  4565. * @see getNextBlockClientId in core/block-editor store.
  4566. */
  4567. var getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId');
  4568. /**
  4569. * @see getSelectedBlocksInitialCaretPosition in core/block-editor store.
  4570. */
  4571. var getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition');
  4572. /**
  4573. * @see getMultiSelectedBlockClientIds in core/block-editor store.
  4574. */
  4575. var getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds');
  4576. /**
  4577. * @see getMultiSelectedBlocks in core/block-editor store.
  4578. */
  4579. var getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks');
  4580. /**
  4581. * @see getFirstMultiSelectedBlockClientId in core/block-editor store.
  4582. */
  4583. var getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId');
  4584. /**
  4585. * @see getLastMultiSelectedBlockClientId in core/block-editor store.
  4586. */
  4587. var getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId');
  4588. /**
  4589. * @see isFirstMultiSelectedBlock in core/block-editor store.
  4590. */
  4591. var isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock');
  4592. /**
  4593. * @see isBlockMultiSelected in core/block-editor store.
  4594. */
  4595. var isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected');
  4596. /**
  4597. * @see isAncestorMultiSelected in core/block-editor store.
  4598. */
  4599. var isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected');
  4600. /**
  4601. * @see getMultiSelectedBlocksStartClientId in core/block-editor store.
  4602. */
  4603. var getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId');
  4604. /**
  4605. * @see getMultiSelectedBlocksEndClientId in core/block-editor store.
  4606. */
  4607. var getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId');
  4608. /**
  4609. * @see getBlockOrder in core/block-editor store.
  4610. */
  4611. var getBlockOrder = getBlockEditorSelector('getBlockOrder');
  4612. /**
  4613. * @see getBlockIndex in core/block-editor store.
  4614. */
  4615. var getBlockIndex = getBlockEditorSelector('getBlockIndex');
  4616. /**
  4617. * @see isBlockSelected in core/block-editor store.
  4618. */
  4619. var isBlockSelected = getBlockEditorSelector('isBlockSelected');
  4620. /**
  4621. * @see hasSelectedInnerBlock in core/block-editor store.
  4622. */
  4623. var hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock');
  4624. /**
  4625. * @see isBlockWithinSelection in core/block-editor store.
  4626. */
  4627. var isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection');
  4628. /**
  4629. * @see hasMultiSelection in core/block-editor store.
  4630. */
  4631. var hasMultiSelection = getBlockEditorSelector('hasMultiSelection');
  4632. /**
  4633. * @see isMultiSelecting in core/block-editor store.
  4634. */
  4635. var isMultiSelecting = getBlockEditorSelector('isMultiSelecting');
  4636. /**
  4637. * @see isSelectionEnabled in core/block-editor store.
  4638. */
  4639. var isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled');
  4640. /**
  4641. * @see getBlockMode in core/block-editor store.
  4642. */
  4643. var getBlockMode = getBlockEditorSelector('getBlockMode');
  4644. /**
  4645. * @see isTyping in core/block-editor store.
  4646. */
  4647. var isTyping = getBlockEditorSelector('isTyping');
  4648. /**
  4649. * @see isCaretWithinFormattedText in core/block-editor store.
  4650. */
  4651. var isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText');
  4652. /**
  4653. * @see getBlockInsertionPoint in core/block-editor store.
  4654. */
  4655. var getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint');
  4656. /**
  4657. * @see isBlockInsertionPointVisible in core/block-editor store.
  4658. */
  4659. var isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible');
  4660. /**
  4661. * @see isValidTemplate in core/block-editor store.
  4662. */
  4663. var isValidTemplate = getBlockEditorSelector('isValidTemplate');
  4664. /**
  4665. * @see getTemplate in core/block-editor store.
  4666. */
  4667. var getTemplate = getBlockEditorSelector('getTemplate');
  4668. /**
  4669. * @see getTemplateLock in core/block-editor store.
  4670. */
  4671. var getTemplateLock = getBlockEditorSelector('getTemplateLock');
  4672. /**
  4673. * @see canInsertBlockType in core/block-editor store.
  4674. */
  4675. var selectors_canInsertBlockType = getBlockEditorSelector('canInsertBlockType');
  4676. /**
  4677. * @see getInserterItems in core/block-editor store.
  4678. */
  4679. var selectors_getInserterItems = getBlockEditorSelector('getInserterItems');
  4680. /**
  4681. * @see hasInserterItems in core/block-editor store.
  4682. */
  4683. var hasInserterItems = getBlockEditorSelector('hasInserterItems');
  4684. /**
  4685. * @see getBlockListSettings in core/block-editor store.
  4686. */
  4687. var getBlockListSettings = getBlockEditorSelector('getBlockListSettings');
  4688. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects/reusable-blocks.js
  4689. /**
  4690. * External dependencies
  4691. */
  4692. /**
  4693. * WordPress dependencies
  4694. */
  4695. // TODO: Ideally this would be the only dispatch in scope. This requires either
  4696. // refactoring editor actions to yielded controls, or replacing direct dispatch
  4697. // on the editor store with action creators (e.g. `REMOVE_REUSABLE_BLOCK`).
  4698. /**
  4699. * Internal dependencies
  4700. */
  4701. /**
  4702. * Module Constants
  4703. */
  4704. var REUSABLE_BLOCK_NOTICE_ID = 'REUSABLE_BLOCK_NOTICE_ID';
  4705. /**
  4706. * Fetch Reusable Blocks Effect Handler.
  4707. *
  4708. * @param {Object} action action object.
  4709. * @param {Object} store Redux Store.
  4710. */
  4711. var fetchReusableBlocks =
  4712. /*#__PURE__*/
  4713. function () {
  4714. var _ref = Object(asyncToGenerator["a" /* default */])(
  4715. /*#__PURE__*/
  4716. regenerator_default.a.mark(function _callee(action, store) {
  4717. var id, dispatch, postType, posts, results;
  4718. return regenerator_default.a.wrap(function _callee$(_context) {
  4719. while (1) {
  4720. switch (_context.prev = _context.next) {
  4721. case 0:
  4722. id = action.id;
  4723. dispatch = store.dispatch; // TODO: these are potentially undefined, this fix is in place
  4724. // until there is a filter to not use reusable blocks if undefined
  4725. _context.next = 4;
  4726. return external_this_wp_apiFetch_default()({
  4727. path: '/wp/v2/types/wp_block'
  4728. });
  4729. case 4:
  4730. postType = _context.sent;
  4731. if (postType) {
  4732. _context.next = 7;
  4733. break;
  4734. }
  4735. return _context.abrupt("return");
  4736. case 7:
  4737. _context.prev = 7;
  4738. if (!id) {
  4739. _context.next = 15;
  4740. break;
  4741. }
  4742. _context.next = 11;
  4743. return external_this_wp_apiFetch_default()({
  4744. path: "/wp/v2/".concat(postType.rest_base, "/").concat(id)
  4745. });
  4746. case 11:
  4747. _context.t0 = _context.sent;
  4748. posts = [_context.t0];
  4749. _context.next = 18;
  4750. break;
  4751. case 15:
  4752. _context.next = 17;
  4753. return external_this_wp_apiFetch_default()({
  4754. path: "/wp/v2/".concat(postType.rest_base, "?per_page=-1")
  4755. });
  4756. case 17:
  4757. posts = _context.sent;
  4758. case 18:
  4759. results = Object(external_lodash_["compact"])(Object(external_lodash_["map"])(posts, function (post) {
  4760. if (post.status !== 'publish' || post.content.protected) {
  4761. return null;
  4762. }
  4763. return Object(objectSpread["a" /* default */])({}, post, {
  4764. content: post.content.raw,
  4765. title: post.title.raw
  4766. });
  4767. }));
  4768. if (results.length) {
  4769. dispatch(__experimentalReceiveReusableBlocks(results));
  4770. }
  4771. dispatch({
  4772. type: 'FETCH_REUSABLE_BLOCKS_SUCCESS',
  4773. id: id
  4774. });
  4775. _context.next = 26;
  4776. break;
  4777. case 23:
  4778. _context.prev = 23;
  4779. _context.t1 = _context["catch"](7);
  4780. dispatch({
  4781. type: 'FETCH_REUSABLE_BLOCKS_FAILURE',
  4782. id: id,
  4783. error: _context.t1
  4784. });
  4785. case 26:
  4786. case "end":
  4787. return _context.stop();
  4788. }
  4789. }
  4790. }, _callee, null, [[7, 23]]);
  4791. }));
  4792. return function fetchReusableBlocks(_x, _x2) {
  4793. return _ref.apply(this, arguments);
  4794. };
  4795. }();
  4796. /**
  4797. * Save Reusable Blocks Effect Handler.
  4798. *
  4799. * @param {Object} action action object.
  4800. * @param {Object} store Redux Store.
  4801. */
  4802. var saveReusableBlocks =
  4803. /*#__PURE__*/
  4804. function () {
  4805. var _ref2 = Object(asyncToGenerator["a" /* default */])(
  4806. /*#__PURE__*/
  4807. regenerator_default.a.mark(function _callee2(action, store) {
  4808. var postType, id, dispatch, state, _getReusableBlock, title, content, isTemporary, data, path, method, updatedReusableBlock, message;
  4809. return regenerator_default.a.wrap(function _callee2$(_context2) {
  4810. while (1) {
  4811. switch (_context2.prev = _context2.next) {
  4812. case 0:
  4813. _context2.next = 2;
  4814. return external_this_wp_apiFetch_default()({
  4815. path: '/wp/v2/types/wp_block'
  4816. });
  4817. case 2:
  4818. postType = _context2.sent;
  4819. if (postType) {
  4820. _context2.next = 5;
  4821. break;
  4822. }
  4823. return _context2.abrupt("return");
  4824. case 5:
  4825. id = action.id;
  4826. dispatch = store.dispatch;
  4827. state = store.getState();
  4828. _getReusableBlock = __experimentalGetReusableBlock(state, id), title = _getReusableBlock.title, content = _getReusableBlock.content, isTemporary = _getReusableBlock.isTemporary;
  4829. data = isTemporary ? {
  4830. title: title,
  4831. content: content,
  4832. status: 'publish'
  4833. } : {
  4834. id: id,
  4835. title: title,
  4836. content: content,
  4837. status: 'publish'
  4838. };
  4839. path = isTemporary ? "/wp/v2/".concat(postType.rest_base) : "/wp/v2/".concat(postType.rest_base, "/").concat(id);
  4840. method = isTemporary ? 'POST' : 'PUT';
  4841. _context2.prev = 12;
  4842. _context2.next = 15;
  4843. return external_this_wp_apiFetch_default()({
  4844. path: path,
  4845. data: data,
  4846. method: method
  4847. });
  4848. case 15:
  4849. updatedReusableBlock = _context2.sent;
  4850. dispatch({
  4851. type: 'SAVE_REUSABLE_BLOCK_SUCCESS',
  4852. updatedId: updatedReusableBlock.id,
  4853. id: id
  4854. });
  4855. message = isTemporary ? Object(external_this_wp_i18n_["__"])('Block created.') : Object(external_this_wp_i18n_["__"])('Block updated.');
  4856. Object(external_this_wp_data_["dispatch"])('core/notices').createSuccessNotice(message, {
  4857. id: REUSABLE_BLOCK_NOTICE_ID,
  4858. type: 'snackbar'
  4859. });
  4860. Object(external_this_wp_data_["dispatch"])('core/block-editor').__unstableSaveReusableBlock(id, updatedReusableBlock.id);
  4861. _context2.next = 26;
  4862. break;
  4863. case 22:
  4864. _context2.prev = 22;
  4865. _context2.t0 = _context2["catch"](12);
  4866. dispatch({
  4867. type: 'SAVE_REUSABLE_BLOCK_FAILURE',
  4868. id: id
  4869. });
  4870. Object(external_this_wp_data_["dispatch"])('core/notices').createErrorNotice(_context2.t0.message, {
  4871. id: REUSABLE_BLOCK_NOTICE_ID
  4872. });
  4873. case 26:
  4874. case "end":
  4875. return _context2.stop();
  4876. }
  4877. }
  4878. }, _callee2, null, [[12, 22]]);
  4879. }));
  4880. return function saveReusableBlocks(_x3, _x4) {
  4881. return _ref2.apply(this, arguments);
  4882. };
  4883. }();
  4884. /**
  4885. * Delete Reusable Blocks Effect Handler.
  4886. *
  4887. * @param {Object} action action object.
  4888. * @param {Object} store Redux Store.
  4889. */
  4890. var deleteReusableBlocks =
  4891. /*#__PURE__*/
  4892. function () {
  4893. var _ref3 = Object(asyncToGenerator["a" /* default */])(
  4894. /*#__PURE__*/
  4895. regenerator_default.a.mark(function _callee3(action, store) {
  4896. var postType, id, getState, dispatch, reusableBlock, allBlocks, associatedBlocks, associatedBlockClientIds, transactionId, message;
  4897. return regenerator_default.a.wrap(function _callee3$(_context3) {
  4898. while (1) {
  4899. switch (_context3.prev = _context3.next) {
  4900. case 0:
  4901. _context3.next = 2;
  4902. return external_this_wp_apiFetch_default()({
  4903. path: '/wp/v2/types/wp_block'
  4904. });
  4905. case 2:
  4906. postType = _context3.sent;
  4907. if (postType) {
  4908. _context3.next = 5;
  4909. break;
  4910. }
  4911. return _context3.abrupt("return");
  4912. case 5:
  4913. id = action.id;
  4914. getState = store.getState, dispatch = store.dispatch; // Don't allow a reusable block with a temporary ID to be deleted
  4915. reusableBlock = __experimentalGetReusableBlock(getState(), id);
  4916. if (!(!reusableBlock || reusableBlock.isTemporary)) {
  4917. _context3.next = 10;
  4918. break;
  4919. }
  4920. return _context3.abrupt("return");
  4921. case 10:
  4922. // Remove any other blocks that reference this reusable block
  4923. allBlocks = Object(external_this_wp_data_["select"])('core/block-editor').getBlocks();
  4924. associatedBlocks = allBlocks.filter(function (block) {
  4925. return Object(external_this_wp_blocks_["isReusableBlock"])(block) && block.attributes.ref === id;
  4926. });
  4927. associatedBlockClientIds = associatedBlocks.map(function (block) {
  4928. return block.clientId;
  4929. });
  4930. transactionId = Object(external_lodash_["uniqueId"])();
  4931. dispatch({
  4932. type: 'REMOVE_REUSABLE_BLOCK',
  4933. id: id,
  4934. optimist: {
  4935. type: redux_optimist["BEGIN"],
  4936. id: transactionId
  4937. }
  4938. }); // Remove the parsed block.
  4939. if (associatedBlockClientIds.length) {
  4940. Object(external_this_wp_data_["dispatch"])('core/block-editor').removeBlocks(associatedBlockClientIds);
  4941. }
  4942. _context3.prev = 16;
  4943. _context3.next = 19;
  4944. return external_this_wp_apiFetch_default()({
  4945. path: "/wp/v2/".concat(postType.rest_base, "/").concat(id),
  4946. method: 'DELETE'
  4947. });
  4948. case 19:
  4949. dispatch({
  4950. type: 'DELETE_REUSABLE_BLOCK_SUCCESS',
  4951. id: id,
  4952. optimist: {
  4953. type: redux_optimist["COMMIT"],
  4954. id: transactionId
  4955. }
  4956. });
  4957. message = Object(external_this_wp_i18n_["__"])('Block deleted.');
  4958. Object(external_this_wp_data_["dispatch"])('core/notices').createSuccessNotice(message, {
  4959. id: REUSABLE_BLOCK_NOTICE_ID,
  4960. type: 'snackbar'
  4961. });
  4962. _context3.next = 28;
  4963. break;
  4964. case 24:
  4965. _context3.prev = 24;
  4966. _context3.t0 = _context3["catch"](16);
  4967. dispatch({
  4968. type: 'DELETE_REUSABLE_BLOCK_FAILURE',
  4969. id: id,
  4970. optimist: {
  4971. type: redux_optimist["REVERT"],
  4972. id: transactionId
  4973. }
  4974. });
  4975. Object(external_this_wp_data_["dispatch"])('core/notices').createErrorNotice(_context3.t0.message, {
  4976. id: REUSABLE_BLOCK_NOTICE_ID
  4977. });
  4978. case 28:
  4979. case "end":
  4980. return _context3.stop();
  4981. }
  4982. }
  4983. }, _callee3, null, [[16, 24]]);
  4984. }));
  4985. return function deleteReusableBlocks(_x5, _x6) {
  4986. return _ref3.apply(this, arguments);
  4987. };
  4988. }();
  4989. /**
  4990. * Convert a reusable block to a static block effect handler
  4991. *
  4992. * @param {Object} action action object.
  4993. * @param {Object} store Redux Store.
  4994. */
  4995. var reusable_blocks_convertBlockToStatic = function convertBlockToStatic(action, store) {
  4996. var state = store.getState();
  4997. var oldBlock = Object(external_this_wp_data_["select"])('core/block-editor').getBlock(action.clientId);
  4998. var reusableBlock = __experimentalGetReusableBlock(state, oldBlock.attributes.ref);
  4999. var newBlocks = Object(external_this_wp_blocks_["parse"])(reusableBlock.content);
  5000. Object(external_this_wp_data_["dispatch"])('core/block-editor').replaceBlocks(oldBlock.clientId, newBlocks);
  5001. };
  5002. /**
  5003. * Convert a static block to a reusable block effect handler
  5004. *
  5005. * @param {Object} action action object.
  5006. * @param {Object} store Redux Store.
  5007. */
  5008. var reusable_blocks_convertBlockToReusable = function convertBlockToReusable(action, store) {
  5009. var dispatch = store.dispatch;
  5010. var reusableBlock = {
  5011. id: Object(external_lodash_["uniqueId"])('reusable'),
  5012. title: Object(external_this_wp_i18n_["__"])('Untitled Reusable Block'),
  5013. content: Object(external_this_wp_blocks_["serialize"])(Object(external_this_wp_data_["select"])('core/block-editor').getBlocksByClientId(action.clientIds))
  5014. };
  5015. dispatch(__experimentalReceiveReusableBlocks([reusableBlock]));
  5016. dispatch(__experimentalSaveReusableBlock(reusableBlock.id));
  5017. Object(external_this_wp_data_["dispatch"])('core/block-editor').replaceBlocks(action.clientIds, Object(external_this_wp_blocks_["createBlock"])('core/block', {
  5018. ref: reusableBlock.id
  5019. }));
  5020. };
  5021. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects.js
  5022. /**
  5023. * Internal dependencies
  5024. */
  5025. /* harmony default export */ var effects = ({
  5026. FETCH_REUSABLE_BLOCKS: function FETCH_REUSABLE_BLOCKS(action, store) {
  5027. fetchReusableBlocks(action, store);
  5028. },
  5029. SAVE_REUSABLE_BLOCK: function SAVE_REUSABLE_BLOCK(action, store) {
  5030. saveReusableBlocks(action, store);
  5031. },
  5032. DELETE_REUSABLE_BLOCK: function DELETE_REUSABLE_BLOCK(action, store) {
  5033. deleteReusableBlocks(action, store);
  5034. },
  5035. CONVERT_BLOCK_TO_STATIC: reusable_blocks_convertBlockToStatic,
  5036. CONVERT_BLOCK_TO_REUSABLE: reusable_blocks_convertBlockToReusable
  5037. });
  5038. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/middlewares.js
  5039. /**
  5040. * External dependencies
  5041. */
  5042. /**
  5043. * Internal dependencies
  5044. */
  5045. /**
  5046. * Applies the custom middlewares used specifically in the editor module.
  5047. *
  5048. * @param {Object} store Store Object.
  5049. *
  5050. * @return {Object} Update Store Object.
  5051. */
  5052. function applyMiddlewares(store) {
  5053. var enhancedDispatch = function enhancedDispatch() {
  5054. throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
  5055. };
  5056. var middlewareAPI = {
  5057. getState: store.getState,
  5058. dispatch: function dispatch() {
  5059. return enhancedDispatch.apply(void 0, arguments);
  5060. }
  5061. };
  5062. enhancedDispatch = refx_default()(effects)(middlewareAPI)(store.dispatch);
  5063. store.dispatch = enhancedDispatch;
  5064. return store;
  5065. }
  5066. /* harmony default export */ var middlewares = (applyMiddlewares);
  5067. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js
  5068. /**
  5069. * WordPress dependencies
  5070. */
  5071. /**
  5072. * Internal dependencies
  5073. */
  5074. /**
  5075. * Post editor data store configuration.
  5076. *
  5077. * @see https://github.com/WordPress/gutenberg/blob/master/packages/data/README.md#registerStore
  5078. *
  5079. * @type {Object}
  5080. */
  5081. var storeConfig = {
  5082. reducer: reducer,
  5083. selectors: selectors_namespaceObject,
  5084. actions: actions_namespaceObject,
  5085. controls: Object(objectSpread["a" /* default */])({}, external_this_wp_dataControls_["controls"], store_controls)
  5086. };
  5087. var store_store = Object(external_this_wp_data_["registerStore"])(STORE_KEY, Object(objectSpread["a" /* default */])({}, storeConfig, {
  5088. persist: ['preferences']
  5089. }));
  5090. middlewares(store_store);
  5091. /* harmony default export */ var build_module_store = (store_store);
  5092. // EXTERNAL MODULE: external {"this":["wp","hooks"]}
  5093. var external_this_wp_hooks_ = __webpack_require__(27);
  5094. // EXTERNAL MODULE: external {"this":["wp","element"]}
  5095. var external_this_wp_element_ = __webpack_require__(0);
  5096. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/block.js
  5097. /**
  5098. * External dependencies
  5099. */
  5100. /**
  5101. * WordPress dependencies
  5102. */
  5103. /**
  5104. * Returns the client ID of the parent where a newly inserted block would be
  5105. * placed.
  5106. *
  5107. * @return {string} Client ID of the parent where a newly inserted block would
  5108. * be placed.
  5109. */
  5110. function defaultGetBlockInsertionParentClientId() {
  5111. return Object(external_this_wp_data_["select"])('core/block-editor').getBlockInsertionPoint().rootClientId;
  5112. }
  5113. /**
  5114. * Returns the inserter items for the specified parent block.
  5115. *
  5116. * @param {string} rootClientId Client ID of the block for which to retrieve
  5117. * inserter items.
  5118. *
  5119. * @return {Array<Editor.InserterItem>} The inserter items for the specified
  5120. * parent.
  5121. */
  5122. function defaultGetInserterItems(rootClientId) {
  5123. return Object(external_this_wp_data_["select"])('core/block-editor').getInserterItems(rootClientId);
  5124. }
  5125. /**
  5126. * Returns the name of the currently selected block.
  5127. *
  5128. * @return {string?} The name of the currently selected block or `null` if no
  5129. * block is selected.
  5130. */
  5131. function defaultGetSelectedBlockName() {
  5132. var _select = Object(external_this_wp_data_["select"])('core/block-editor'),
  5133. getSelectedBlockClientId = _select.getSelectedBlockClientId,
  5134. getBlockName = _select.getBlockName;
  5135. var selectedBlockClientId = getSelectedBlockClientId();
  5136. return selectedBlockClientId ? getBlockName(selectedBlockClientId) : null;
  5137. }
  5138. /**
  5139. * Triggers a fetch of reusable blocks, once.
  5140. *
  5141. * TODO: Reusable blocks fetching should be reimplemented as a core-data entity
  5142. * resolver, not relying on `core/editor` (see #7119). The implementation here
  5143. * is imperfect in that the options result will not await the completion of the
  5144. * fetch request and thus will not include any reusable blocks. This has always
  5145. * been true, but relied upon the fact the user would be delayed in typing an
  5146. * autocompleter search query. Once implemented using resolvers, the status of
  5147. * this request could be subscribed to as part of a promised return value using
  5148. * the result of `hasFinishedResolution`. There is currently reliable way to
  5149. * determine that a reusable blocks fetch request has completed.
  5150. *
  5151. * @return {Promise} Promise resolving once reusable blocks fetched.
  5152. */
  5153. var block_fetchReusableBlocks = Object(external_lodash_["once"])(function () {
  5154. Object(external_this_wp_data_["dispatch"])('core/editor').__experimentalFetchReusableBlocks();
  5155. });
  5156. /**
  5157. * Creates a blocks repeater for replacing the current block with a selected block type.
  5158. *
  5159. * @return {Completer} A blocks completer.
  5160. */
  5161. function createBlockCompleter() {
  5162. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  5163. _ref$getBlockInsertio = _ref.getBlockInsertionParentClientId,
  5164. getBlockInsertionParentClientId = _ref$getBlockInsertio === void 0 ? defaultGetBlockInsertionParentClientId : _ref$getBlockInsertio,
  5165. _ref$getInserterItems = _ref.getInserterItems,
  5166. getInserterItems = _ref$getInserterItems === void 0 ? defaultGetInserterItems : _ref$getInserterItems,
  5167. _ref$getSelectedBlock = _ref.getSelectedBlockName,
  5168. getSelectedBlockName = _ref$getSelectedBlock === void 0 ? defaultGetSelectedBlockName : _ref$getSelectedBlock;
  5169. return {
  5170. name: 'blocks',
  5171. className: 'editor-autocompleters__block',
  5172. triggerPrefix: '/',
  5173. options: function options() {
  5174. block_fetchReusableBlocks();
  5175. var selectedBlockName = getSelectedBlockName();
  5176. return getInserterItems(getBlockInsertionParentClientId()).filter( // Avoid offering to replace the current block with a block of the same type.
  5177. function (inserterItem) {
  5178. return selectedBlockName !== inserterItem.name;
  5179. });
  5180. },
  5181. getOptionKeywords: function getOptionKeywords(inserterItem) {
  5182. var title = inserterItem.title,
  5183. _inserterItem$keyword = inserterItem.keywords,
  5184. keywords = _inserterItem$keyword === void 0 ? [] : _inserterItem$keyword,
  5185. category = inserterItem.category;
  5186. return [category].concat(Object(toConsumableArray["a" /* default */])(keywords), [title]);
  5187. },
  5188. getOptionLabel: function getOptionLabel(inserterItem) {
  5189. var icon = inserterItem.icon,
  5190. title = inserterItem.title;
  5191. return [Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], {
  5192. key: "icon",
  5193. icon: icon,
  5194. showColors: true
  5195. }), title];
  5196. },
  5197. allowContext: function allowContext(before, after) {
  5198. return !(/\S/.test(before) || /\S/.test(after));
  5199. },
  5200. getOptionCompletion: function getOptionCompletion(inserterItem) {
  5201. var name = inserterItem.name,
  5202. initialAttributes = inserterItem.initialAttributes;
  5203. return {
  5204. action: 'replace',
  5205. value: Object(external_this_wp_blocks_["createBlock"])(name, initialAttributes)
  5206. };
  5207. },
  5208. isOptionDisabled: function isOptionDisabled(inserterItem) {
  5209. return inserterItem.isDisabled;
  5210. }
  5211. };
  5212. }
  5213. /**
  5214. * Creates a blocks repeater for replacing the current block with a selected block type.
  5215. *
  5216. * @return {Completer} A blocks completer.
  5217. */
  5218. /* harmony default export */ var autocompleters_block = (createBlockCompleter());
  5219. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js
  5220. /**
  5221. * WordPress dependencies
  5222. */
  5223. /**
  5224. * A user mentions completer.
  5225. *
  5226. * @type {Completer}
  5227. */
  5228. /* harmony default export */ var autocompleters_user = ({
  5229. name: 'users',
  5230. className: 'editor-autocompleters__user',
  5231. triggerPrefix: '@',
  5232. options: function options(search) {
  5233. var payload = '';
  5234. if (search) {
  5235. payload = '?search=' + encodeURIComponent(search);
  5236. }
  5237. return external_this_wp_apiFetch_default()({
  5238. path: '/wp/v2/users' + payload
  5239. });
  5240. },
  5241. isDebounced: true,
  5242. getOptionKeywords: function getOptionKeywords(user) {
  5243. return [user.slug, user.name];
  5244. },
  5245. getOptionLabel: function getOptionLabel(user) {
  5246. return [Object(external_this_wp_element_["createElement"])("img", {
  5247. key: "avatar",
  5248. className: "editor-autocompleters__user-avatar",
  5249. alt: "",
  5250. src: user.avatar_urls[24]
  5251. }), Object(external_this_wp_element_["createElement"])("span", {
  5252. key: "name",
  5253. className: "editor-autocompleters__user-name"
  5254. }, user.name), Object(external_this_wp_element_["createElement"])("span", {
  5255. key: "slug",
  5256. className: "editor-autocompleters__user-slug"
  5257. }, user.slug)];
  5258. },
  5259. getOptionCompletion: function getOptionCompletion(user) {
  5260. return "@".concat(user.slug);
  5261. }
  5262. });
  5263. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js
  5264. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
  5265. var classCallCheck = __webpack_require__(12);
  5266. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
  5267. var createClass = __webpack_require__(11);
  5268. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
  5269. var possibleConstructorReturn = __webpack_require__(13);
  5270. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
  5271. var getPrototypeOf = __webpack_require__(14);
  5272. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
  5273. var inherits = __webpack_require__(15);
  5274. // EXTERNAL MODULE: external {"this":["wp","compose"]}
  5275. var external_this_wp_compose_ = __webpack_require__(8);
  5276. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js
  5277. /**
  5278. * WordPress dependencies
  5279. */
  5280. var autosave_monitor_AutosaveMonitor =
  5281. /*#__PURE__*/
  5282. function (_Component) {
  5283. Object(inherits["a" /* default */])(AutosaveMonitor, _Component);
  5284. function AutosaveMonitor() {
  5285. Object(classCallCheck["a" /* default */])(this, AutosaveMonitor);
  5286. return Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(AutosaveMonitor).apply(this, arguments));
  5287. }
  5288. Object(createClass["a" /* default */])(AutosaveMonitor, [{
  5289. key: "componentDidUpdate",
  5290. value: function componentDidUpdate(prevProps) {
  5291. var _this$props = this.props,
  5292. isDirty = _this$props.isDirty,
  5293. editsReference = _this$props.editsReference,
  5294. isAutosaveable = _this$props.isAutosaveable,
  5295. isAutosaving = _this$props.isAutosaving; // The edits reference is held for comparison to avoid scheduling an
  5296. // autosave if an edit has not been made since the last autosave
  5297. // completion. This is assigned when the autosave completes, and reset
  5298. // when an edit occurs.
  5299. //
  5300. // See: https://github.com/WordPress/gutenberg/issues/12318
  5301. if (editsReference !== prevProps.editsReference) {
  5302. this.didAutosaveForEditsReference = false;
  5303. }
  5304. if (!isAutosaving && prevProps.isAutosaving) {
  5305. this.didAutosaveForEditsReference = true;
  5306. }
  5307. if (prevProps.isDirty !== isDirty || prevProps.isAutosaveable !== isAutosaveable || prevProps.editsReference !== editsReference) {
  5308. this.toggleTimer(isDirty && isAutosaveable && !this.didAutosaveForEditsReference);
  5309. }
  5310. }
  5311. }, {
  5312. key: "componentWillUnmount",
  5313. value: function componentWillUnmount() {
  5314. this.toggleTimer(false);
  5315. }
  5316. }, {
  5317. key: "toggleTimer",
  5318. value: function toggleTimer(isPendingSave) {
  5319. var _this = this;
  5320. var _this$props2 = this.props,
  5321. interval = _this$props2.interval,
  5322. _this$props2$shouldTh = _this$props2.shouldThrottle,
  5323. shouldThrottle = _this$props2$shouldTh === void 0 ? false : _this$props2$shouldTh; // By default, AutosaveMonitor will wait for a pause in editing before
  5324. // autosaving. In other words, its action is "debounced".
  5325. //
  5326. // The `shouldThrottle` props allows overriding this behaviour, thus
  5327. // making the autosave action "throttled".
  5328. if (!shouldThrottle && this.pendingSave) {
  5329. clearTimeout(this.pendingSave);
  5330. delete this.pendingSave;
  5331. }
  5332. if (isPendingSave && !(shouldThrottle && this.pendingSave)) {
  5333. this.pendingSave = setTimeout(function () {
  5334. _this.props.autosave();
  5335. delete _this.pendingSave;
  5336. }, interval * 1000);
  5337. }
  5338. }
  5339. }, {
  5340. key: "render",
  5341. value: function render() {
  5342. return null;
  5343. }
  5344. }]);
  5345. return AutosaveMonitor;
  5346. }(external_this_wp_element_["Component"]);
  5347. /* harmony default export */ var autosave_monitor = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, ownProps) {
  5348. var _select = select('core'),
  5349. getReferenceByDistinctEdits = _select.getReferenceByDistinctEdits;
  5350. var _select2 = select('core/editor'),
  5351. isEditedPostDirty = _select2.isEditedPostDirty,
  5352. isEditedPostAutosaveable = _select2.isEditedPostAutosaveable,
  5353. isAutosavingPost = _select2.isAutosavingPost,
  5354. getEditorSettings = _select2.getEditorSettings;
  5355. var _ownProps$interval = ownProps.interval,
  5356. interval = _ownProps$interval === void 0 ? getEditorSettings().autosaveInterval : _ownProps$interval;
  5357. return {
  5358. isDirty: isEditedPostDirty(),
  5359. isAutosaveable: isEditedPostAutosaveable(),
  5360. editsReference: getReferenceByDistinctEdits(),
  5361. isAutosaving: isAutosavingPost(),
  5362. interval: interval
  5363. };
  5364. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) {
  5365. return {
  5366. autosave: function autosave() {
  5367. var _ownProps$autosave = ownProps.autosave,
  5368. autosave = _ownProps$autosave === void 0 ? dispatch('core/editor').autosave : _ownProps$autosave;
  5369. autosave();
  5370. }
  5371. };
  5372. })])(autosave_monitor_AutosaveMonitor));
  5373. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  5374. var classnames = __webpack_require__(16);
  5375. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  5376. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js
  5377. /**
  5378. * External dependencies
  5379. */
  5380. /**
  5381. * WordPress dependencies
  5382. */
  5383. var item_TableOfContentsItem = function TableOfContentsItem(_ref) {
  5384. var children = _ref.children,
  5385. isValid = _ref.isValid,
  5386. level = _ref.level,
  5387. _ref$path = _ref.path,
  5388. path = _ref$path === void 0 ? [] : _ref$path,
  5389. href = _ref.href,
  5390. onSelect = _ref.onSelect;
  5391. return Object(external_this_wp_element_["createElement"])("li", {
  5392. className: classnames_default()('document-outline__item', "is-".concat(level.toLowerCase()), {
  5393. 'is-invalid': !isValid
  5394. })
  5395. }, Object(external_this_wp_element_["createElement"])("a", {
  5396. href: href,
  5397. className: "document-outline__button",
  5398. onClick: onSelect
  5399. }, Object(external_this_wp_element_["createElement"])("span", {
  5400. className: "document-outline__emdash",
  5401. "aria-hidden": "true"
  5402. }), // path is an array of nodes that are ancestors of the heading starting in the top level node.
  5403. // This mapping renders each ancestor to make it easier for the user to know where the headings are nested.
  5404. path.map(function (_ref2, index) {
  5405. var clientId = _ref2.clientId;
  5406. return Object(external_this_wp_element_["createElement"])("strong", {
  5407. key: index,
  5408. className: "document-outline__level"
  5409. }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockTitle"], {
  5410. clientId: clientId
  5411. }));
  5412. }), Object(external_this_wp_element_["createElement"])("strong", {
  5413. className: "document-outline__level"
  5414. }, level), Object(external_this_wp_element_["createElement"])("span", {
  5415. className: "document-outline__item-content"
  5416. }, children)));
  5417. };
  5418. /* harmony default export */ var document_outline_item = (item_TableOfContentsItem);
  5419. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js
  5420. /**
  5421. * External dependencies
  5422. */
  5423. /**
  5424. * WordPress dependencies
  5425. */
  5426. /**
  5427. * Internal dependencies
  5428. */
  5429. /**
  5430. * Module constants
  5431. */
  5432. var emptyHeadingContent = Object(external_this_wp_element_["createElement"])("em", null, Object(external_this_wp_i18n_["__"])('(Empty heading)'));
  5433. var incorrectLevelContent = [Object(external_this_wp_element_["createElement"])("br", {
  5434. key: "incorrect-break"
  5435. }), Object(external_this_wp_element_["createElement"])("em", {
  5436. key: "incorrect-message"
  5437. }, Object(external_this_wp_i18n_["__"])('(Incorrect heading level)'))];
  5438. var singleH1Headings = [Object(external_this_wp_element_["createElement"])("br", {
  5439. key: "incorrect-break-h1"
  5440. }), Object(external_this_wp_element_["createElement"])("em", {
  5441. key: "incorrect-message-h1"
  5442. }, Object(external_this_wp_i18n_["__"])('(Your theme may already use a H1 for the post title)'))];
  5443. var multipleH1Headings = [Object(external_this_wp_element_["createElement"])("br", {
  5444. key: "incorrect-break-multiple-h1"
  5445. }), Object(external_this_wp_element_["createElement"])("em", {
  5446. key: "incorrect-message-multiple-h1"
  5447. }, Object(external_this_wp_i18n_["__"])('(Multiple H1 headings are not recommended)'))];
  5448. /**
  5449. * Returns an array of heading blocks enhanced with the following properties:
  5450. * path - An array of blocks that are ancestors of the heading starting from a top-level node.
  5451. * Can be an empty array if the heading is a top-level node (is not nested inside another block).
  5452. * level - An integer with the heading level.
  5453. * isEmpty - Flag indicating if the heading has no content.
  5454. *
  5455. * @param {?Array} blocks An array of blocks.
  5456. * @param {?Array} path An array of blocks that are ancestors of the blocks passed as blocks.
  5457. *
  5458. * @return {Array} An array of heading blocks enhanced with the properties described above.
  5459. */
  5460. var document_outline_computeOutlineHeadings = function computeOutlineHeadings() {
  5461. var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  5462. var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  5463. return Object(external_lodash_["flatMap"])(blocks, function () {
  5464. var block = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  5465. if (block.name === 'core/heading') {
  5466. return Object(objectSpread["a" /* default */])({}, block, {
  5467. path: path,
  5468. level: block.attributes.level,
  5469. isEmpty: isEmptyHeading(block)
  5470. });
  5471. }
  5472. return computeOutlineHeadings(block.innerBlocks, [].concat(Object(toConsumableArray["a" /* default */])(path), [block]));
  5473. });
  5474. };
  5475. var isEmptyHeading = function isEmptyHeading(heading) {
  5476. return !heading.attributes.content || heading.attributes.content.length === 0;
  5477. };
  5478. var document_outline_DocumentOutline = function DocumentOutline(_ref) {
  5479. var _ref$blocks = _ref.blocks,
  5480. blocks = _ref$blocks === void 0 ? [] : _ref$blocks,
  5481. title = _ref.title,
  5482. onSelect = _ref.onSelect,
  5483. isTitleSupported = _ref.isTitleSupported,
  5484. hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled;
  5485. var headings = document_outline_computeOutlineHeadings(blocks);
  5486. if (headings.length < 1) {
  5487. return null;
  5488. }
  5489. var prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now.
  5490. var titleNode = document.querySelector('.editor-post-title__input');
  5491. var hasTitle = isTitleSupported && title && titleNode;
  5492. var countByLevel = Object(external_lodash_["countBy"])(headings, 'level');
  5493. var hasMultipleH1 = countByLevel[1] > 1;
  5494. return Object(external_this_wp_element_["createElement"])("div", {
  5495. className: "document-outline"
  5496. }, Object(external_this_wp_element_["createElement"])("ul", null, hasTitle && Object(external_this_wp_element_["createElement"])(document_outline_item, {
  5497. level: Object(external_this_wp_i18n_["__"])('Title'),
  5498. isValid: true,
  5499. onSelect: onSelect,
  5500. href: "#".concat(titleNode.id),
  5501. isDisabled: hasOutlineItemsDisabled
  5502. }, title), headings.map(function (item, index) {
  5503. // Headings remain the same, go up by one, or down by any amount.
  5504. // Otherwise there are missing levels.
  5505. var isIncorrectLevel = item.level > prevHeadingLevel + 1;
  5506. var isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle);
  5507. prevHeadingLevel = item.level;
  5508. return Object(external_this_wp_element_["createElement"])(document_outline_item, {
  5509. key: index,
  5510. level: "H".concat(item.level),
  5511. isValid: isValid,
  5512. path: item.path,
  5513. isDisabled: hasOutlineItemsDisabled,
  5514. href: "#block-".concat(item.clientId),
  5515. onSelect: onSelect
  5516. }, item.isEmpty ? emptyHeadingContent : Object(external_this_wp_richText_["getTextContent"])(Object(external_this_wp_richText_["create"])({
  5517. html: item.attributes.content
  5518. })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings);
  5519. })));
  5520. };
  5521. /* harmony default export */ var document_outline = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) {
  5522. var _select = select('core/block-editor'),
  5523. getBlocks = _select.getBlocks;
  5524. var _select2 = select('core/editor'),
  5525. getEditedPostAttribute = _select2.getEditedPostAttribute;
  5526. var _select3 = select('core'),
  5527. getPostType = _select3.getPostType;
  5528. var postType = getPostType(getEditedPostAttribute('type'));
  5529. return {
  5530. title: getEditedPostAttribute('title'),
  5531. blocks: getBlocks(),
  5532. isTitleSupported: Object(external_lodash_["get"])(postType, ['supports', 'title'], false)
  5533. };
  5534. }))(document_outline_DocumentOutline));
  5535. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js
  5536. /**
  5537. * External dependencies
  5538. */
  5539. /**
  5540. * WordPress dependencies
  5541. */
  5542. function DocumentOutlineCheck(_ref) {
  5543. var blocks = _ref.blocks,
  5544. children = _ref.children;
  5545. var headings = Object(external_lodash_["filter"])(blocks, function (block) {
  5546. return block.name === 'core/heading';
  5547. });
  5548. if (headings.length < 1) {
  5549. return null;
  5550. }
  5551. return children;
  5552. }
  5553. /* harmony default export */ var check = (Object(external_this_wp_data_["withSelect"])(function (select) {
  5554. return {
  5555. blocks: select('core/block-editor').getBlocks()
  5556. };
  5557. })(DocumentOutlineCheck));
  5558. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
  5559. var assertThisInitialized = __webpack_require__(5);
  5560. // EXTERNAL MODULE: external {"this":["wp","components"]}
  5561. var external_this_wp_components_ = __webpack_require__(3);
  5562. // EXTERNAL MODULE: external {"this":["wp","keycodes"]}
  5563. var external_this_wp_keycodes_ = __webpack_require__(19);
  5564. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js
  5565. /**
  5566. * WordPress dependencies
  5567. */
  5568. function SaveShortcut(_ref) {
  5569. var onSave = _ref.onSave;
  5570. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], {
  5571. bindGlobal: true,
  5572. shortcuts: Object(defineProperty["a" /* default */])({}, external_this_wp_keycodes_["rawShortcut"].primary('s'), function (event) {
  5573. event.preventDefault();
  5574. onSave();
  5575. })
  5576. });
  5577. }
  5578. /* harmony default export */ var save_shortcut = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  5579. var _select = select('core/editor'),
  5580. isEditedPostDirty = _select.isEditedPostDirty;
  5581. return {
  5582. isDirty: isEditedPostDirty()
  5583. };
  5584. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps, _ref3) {
  5585. var select = _ref3.select;
  5586. var _dispatch = dispatch('core/editor'),
  5587. savePost = _dispatch.savePost;
  5588. return {
  5589. onSave: function onSave() {
  5590. // TODO: This should be handled in the `savePost` effect in
  5591. // considering `isSaveable`. See note on `isEditedPostSaveable`
  5592. // selector about dirtiness and meta-boxes.
  5593. //
  5594. // See: `isEditedPostSaveable`
  5595. var _select2 = select('core/editor'),
  5596. isEditedPostDirty = _select2.isEditedPostDirty;
  5597. if (!isEditedPostDirty()) {
  5598. return;
  5599. }
  5600. savePost();
  5601. }
  5602. };
  5603. })])(SaveShortcut));
  5604. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js
  5605. /**
  5606. * WordPress dependencies
  5607. */
  5608. /**
  5609. * Internal dependencies
  5610. */
  5611. var visual_editor_shortcuts_VisualEditorGlobalKeyboardShortcuts =
  5612. /*#__PURE__*/
  5613. function (_Component) {
  5614. Object(inherits["a" /* default */])(VisualEditorGlobalKeyboardShortcuts, _Component);
  5615. function VisualEditorGlobalKeyboardShortcuts() {
  5616. var _this;
  5617. Object(classCallCheck["a" /* default */])(this, VisualEditorGlobalKeyboardShortcuts);
  5618. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(VisualEditorGlobalKeyboardShortcuts).apply(this, arguments));
  5619. _this.undoOrRedo = _this.undoOrRedo.bind(Object(assertThisInitialized["a" /* default */])(_this));
  5620. return _this;
  5621. }
  5622. Object(createClass["a" /* default */])(VisualEditorGlobalKeyboardShortcuts, [{
  5623. key: "undoOrRedo",
  5624. value: function undoOrRedo(event) {
  5625. var _this$props = this.props,
  5626. onRedo = _this$props.onRedo,
  5627. onUndo = _this$props.onUndo;
  5628. if (event.shiftKey) {
  5629. onRedo();
  5630. } else {
  5631. onUndo();
  5632. }
  5633. event.preventDefault();
  5634. }
  5635. }, {
  5636. key: "render",
  5637. value: function render() {
  5638. var _ref;
  5639. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"], null), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], {
  5640. shortcuts: (_ref = {}, Object(defineProperty["a" /* default */])(_ref, external_this_wp_keycodes_["rawShortcut"].primary('z'), this.undoOrRedo), Object(defineProperty["a" /* default */])(_ref, external_this_wp_keycodes_["rawShortcut"].primaryShift('z'), this.undoOrRedo), _ref)
  5641. }), Object(external_this_wp_element_["createElement"])(save_shortcut, null));
  5642. }
  5643. }]);
  5644. return VisualEditorGlobalKeyboardShortcuts;
  5645. }(external_this_wp_element_["Component"]);
  5646. var EnhancedVisualEditorGlobalKeyboardShortcuts = Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  5647. var _dispatch = dispatch('core/editor'),
  5648. redo = _dispatch.redo,
  5649. undo = _dispatch.undo;
  5650. return {
  5651. onRedo: redo,
  5652. onUndo: undo
  5653. };
  5654. })(visual_editor_shortcuts_VisualEditorGlobalKeyboardShortcuts);
  5655. /* harmony default export */ var visual_editor_shortcuts = (EnhancedVisualEditorGlobalKeyboardShortcuts);
  5656. function EditorGlobalKeyboardShortcuts() {
  5657. external_this_wp_deprecated_default()('EditorGlobalKeyboardShortcuts', {
  5658. alternative: 'VisualEditorGlobalKeyboardShortcuts',
  5659. plugin: 'Gutenberg'
  5660. });
  5661. return Object(external_this_wp_element_["createElement"])(EnhancedVisualEditorGlobalKeyboardShortcuts, null);
  5662. }
  5663. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js
  5664. /**
  5665. * Internal dependencies
  5666. */
  5667. function TextEditorGlobalKeyboardShortcuts() {
  5668. return Object(external_this_wp_element_["createElement"])(save_shortcut, null);
  5669. }
  5670. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js
  5671. /**
  5672. * WordPress dependencies
  5673. */
  5674. function EditorHistoryRedo(_ref) {
  5675. var hasRedo = _ref.hasRedo,
  5676. redo = _ref.redo;
  5677. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], {
  5678. icon: "redo",
  5679. label: Object(external_this_wp_i18n_["__"])('Redo'),
  5680. shortcut: external_this_wp_keycodes_["displayShortcut"].primaryShift('z') // If there are no redo levels we don't want to actually disable this
  5681. // button, because it will remove focus for keyboard users.
  5682. // See: https://github.com/WordPress/gutenberg/issues/3486
  5683. ,
  5684. "aria-disabled": !hasRedo,
  5685. onClick: hasRedo ? redo : undefined,
  5686. className: "editor-history__redo"
  5687. });
  5688. }
  5689. /* harmony default export */ var editor_history_redo = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  5690. return {
  5691. hasRedo: select('core/editor').hasEditorRedo()
  5692. };
  5693. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  5694. return {
  5695. redo: dispatch('core/editor').redo
  5696. };
  5697. })])(EditorHistoryRedo));
  5698. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js
  5699. /**
  5700. * WordPress dependencies
  5701. */
  5702. function EditorHistoryUndo(_ref) {
  5703. var hasUndo = _ref.hasUndo,
  5704. undo = _ref.undo;
  5705. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], {
  5706. icon: "undo",
  5707. label: Object(external_this_wp_i18n_["__"])('Undo'),
  5708. shortcut: external_this_wp_keycodes_["displayShortcut"].primary('z') // If there are no undo levels we don't want to actually disable this
  5709. // button, because it will remove focus for keyboard users.
  5710. // See: https://github.com/WordPress/gutenberg/issues/3486
  5711. ,
  5712. "aria-disabled": !hasUndo,
  5713. onClick: hasUndo ? undo : undefined,
  5714. className: "editor-history__undo"
  5715. });
  5716. }
  5717. /* harmony default export */ var editor_history_undo = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  5718. return {
  5719. hasUndo: select('core/editor').hasEditorUndo()
  5720. };
  5721. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  5722. return {
  5723. undo: dispatch('core/editor').undo
  5724. };
  5725. })])(EditorHistoryUndo));
  5726. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules
  5727. var objectWithoutProperties = __webpack_require__(21);
  5728. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js
  5729. /**
  5730. * WordPress dependencies
  5731. */
  5732. function TemplateValidationNotice(_ref) {
  5733. var isValid = _ref.isValid,
  5734. props = Object(objectWithoutProperties["a" /* default */])(_ref, ["isValid"]);
  5735. if (isValid) {
  5736. return null;
  5737. }
  5738. var confirmSynchronization = function confirmSynchronization() {
  5739. // eslint-disable-next-line no-alert
  5740. if (window.confirm(Object(external_this_wp_i18n_["__"])('Resetting the template may result in loss of content, do you want to continue?'))) {
  5741. props.synchronizeTemplate();
  5742. }
  5743. };
  5744. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Notice"], {
  5745. className: "editor-template-validation-notice",
  5746. isDismissible: false,
  5747. status: "warning"
  5748. }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('The content of your post doesn’t match the template assigned to your post type.')), Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  5749. isDefault: true,
  5750. onClick: props.resetTemplateValidity
  5751. }, Object(external_this_wp_i18n_["__"])('Keep it as is')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  5752. onClick: confirmSynchronization,
  5753. isPrimary: true
  5754. }, Object(external_this_wp_i18n_["__"])('Reset the template'))));
  5755. }
  5756. /* harmony default export */ var template_validation_notice = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  5757. return {
  5758. isValid: select('core/block-editor').isValidTemplate()
  5759. };
  5760. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  5761. var _dispatch = dispatch('core/block-editor'),
  5762. setTemplateValidity = _dispatch.setTemplateValidity,
  5763. synchronizeTemplate = _dispatch.synchronizeTemplate;
  5764. return {
  5765. resetTemplateValidity: function resetTemplateValidity() {
  5766. return setTemplateValidity(true);
  5767. },
  5768. synchronizeTemplate: synchronizeTemplate
  5769. };
  5770. })])(TemplateValidationNotice));
  5771. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js
  5772. /**
  5773. * External dependencies
  5774. */
  5775. /**
  5776. * WordPress dependencies
  5777. */
  5778. /**
  5779. * Internal dependencies
  5780. */
  5781. function EditorNotices(_ref) {
  5782. var notices = _ref.notices,
  5783. onRemove = _ref.onRemove;
  5784. var dismissibleNotices = Object(external_lodash_["filter"])(notices, {
  5785. isDismissible: true,
  5786. type: 'default'
  5787. });
  5788. var nonDismissibleNotices = Object(external_lodash_["filter"])(notices, {
  5789. isDismissible: false,
  5790. type: 'default'
  5791. });
  5792. var snackbarNotices = Object(external_lodash_["filter"])(notices, {
  5793. type: 'snackbar'
  5794. });
  5795. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NoticeList"], {
  5796. notices: nonDismissibleNotices,
  5797. className: "components-editor-notices__pinned"
  5798. }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NoticeList"], {
  5799. notices: dismissibleNotices,
  5800. className: "components-editor-notices__dismissible",
  5801. onRemove: onRemove
  5802. }, Object(external_this_wp_element_["createElement"])(template_validation_notice, null)), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SnackbarList"], {
  5803. notices: snackbarNotices,
  5804. className: "components-editor-notices__snackbar",
  5805. onRemove: onRemove
  5806. }));
  5807. }
  5808. /* harmony default export */ var editor_notices = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  5809. return {
  5810. notices: select('core/notices').getNotices()
  5811. };
  5812. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  5813. return {
  5814. onRemove: dispatch('core/notices').removeNotice
  5815. };
  5816. })])(EditorNotices));
  5817. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js
  5818. /**
  5819. * WordPress dependencies
  5820. */
  5821. var error_boundary_ErrorBoundary =
  5822. /*#__PURE__*/
  5823. function (_Component) {
  5824. Object(inherits["a" /* default */])(ErrorBoundary, _Component);
  5825. function ErrorBoundary() {
  5826. var _this;
  5827. Object(classCallCheck["a" /* default */])(this, ErrorBoundary);
  5828. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(ErrorBoundary).apply(this, arguments));
  5829. _this.reboot = _this.reboot.bind(Object(assertThisInitialized["a" /* default */])(_this));
  5830. _this.getContent = _this.getContent.bind(Object(assertThisInitialized["a" /* default */])(_this));
  5831. _this.state = {
  5832. error: null
  5833. };
  5834. return _this;
  5835. }
  5836. Object(createClass["a" /* default */])(ErrorBoundary, [{
  5837. key: "componentDidCatch",
  5838. value: function componentDidCatch(error) {
  5839. this.setState({
  5840. error: error
  5841. });
  5842. }
  5843. }, {
  5844. key: "reboot",
  5845. value: function reboot() {
  5846. this.props.onError();
  5847. }
  5848. }, {
  5849. key: "getContent",
  5850. value: function getContent() {
  5851. try {
  5852. // While `select` in a component is generally discouraged, it is
  5853. // used here because it (a) reduces the chance of data loss in the
  5854. // case of additional errors by performing a direct retrieval and
  5855. // (b) avoids the performance cost associated with unnecessary
  5856. // content serialization throughout the lifetime of a non-erroring
  5857. // application.
  5858. return Object(external_this_wp_data_["select"])('core/editor').getEditedPostContent();
  5859. } catch (error) {}
  5860. }
  5861. }, {
  5862. key: "render",
  5863. value: function render() {
  5864. var error = this.state.error;
  5865. if (!error) {
  5866. return this.props.children;
  5867. }
  5868. return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["Warning"], {
  5869. className: "editor-error-boundary",
  5870. actions: [Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  5871. key: "recovery",
  5872. onClick: this.reboot,
  5873. isLarge: true
  5874. }, Object(external_this_wp_i18n_["__"])('Attempt Recovery')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], {
  5875. key: "copy-post",
  5876. text: this.getContent,
  5877. isLarge: true
  5878. }, Object(external_this_wp_i18n_["__"])('Copy Post Text')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], {
  5879. key: "copy-error",
  5880. text: error.stack,
  5881. isLarge: true
  5882. }, Object(external_this_wp_i18n_["__"])('Copy Error'))]
  5883. }, Object(external_this_wp_i18n_["__"])('The editor has encountered an unexpected error.'));
  5884. }
  5885. }]);
  5886. return ErrorBoundary;
  5887. }(external_this_wp_element_["Component"]);
  5888. /* harmony default export */ var error_boundary = (error_boundary_ErrorBoundary);
  5889. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js
  5890. /**
  5891. * External dependencies
  5892. */
  5893. /**
  5894. * WordPress dependencies
  5895. */
  5896. /**
  5897. * Internal dependencies
  5898. */
  5899. var requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
  5900. /**
  5901. * Function which returns true if the current environment supports browser
  5902. * sessionStorage, or false otherwise. The result of this function is cached and
  5903. * reused in subsequent invocations.
  5904. */
  5905. var hasSessionStorageSupport = Object(external_lodash_["once"])(function () {
  5906. try {
  5907. // Private Browsing in Safari 10 and earlier will throw an error when
  5908. // attempting to set into sessionStorage. The test here is intentional in
  5909. // causing a thrown error as condition bailing from local autosave.
  5910. window.sessionStorage.setItem('__wpEditorTestSessionStorage', '');
  5911. window.sessionStorage.removeItem('__wpEditorTestSessionStorage');
  5912. return true;
  5913. } catch (error) {
  5914. return false;
  5915. }
  5916. });
  5917. /**
  5918. * Custom hook which manages the creation of a notice prompting the user to
  5919. * restore a local autosave, if one exists.
  5920. */
  5921. function useAutosaveNotice() {
  5922. var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) {
  5923. var _postId = select('core/editor').getCurrentPostId();
  5924. var postType = select('core/editor').getCurrentPostType();
  5925. var user = select('core').getCurrentUser();
  5926. return {
  5927. postId: _postId,
  5928. getEditedPostAttribute: select('core/editor').getEditedPostAttribute,
  5929. remoteAutosave: select('core').getAutosave(postType, _postId, user.id),
  5930. hasFetchedAutosave: select('core').hasFetchedAutosaves(postType, _postId) && user.id
  5931. };
  5932. }),
  5933. postId = _useSelect.postId,
  5934. getEditedPostAttribute = _useSelect.getEditedPostAttribute,
  5935. remoteAutosave = _useSelect.remoteAutosave,
  5936. hasFetchedAutosave = _useSelect.hasFetchedAutosave;
  5937. var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/notices'),
  5938. createWarningNotice = _useDispatch.createWarningNotice,
  5939. removeNotice = _useDispatch.removeNotice;
  5940. var _useDispatch2 = Object(external_this_wp_data_["useDispatch"])('core/editor'),
  5941. editPost = _useDispatch2.editPost,
  5942. resetEditorBlocks = _useDispatch2.resetEditorBlocks;
  5943. Object(external_this_wp_element_["useEffect"])(function () {
  5944. if (!hasFetchedAutosave) {
  5945. return;
  5946. }
  5947. var localAutosave = localAutosaveGet(postId);
  5948. if (!localAutosave) {
  5949. return;
  5950. }
  5951. try {
  5952. localAutosave = JSON.parse(localAutosave);
  5953. } catch (error) {
  5954. // Not usable if it can't be parsed.
  5955. return;
  5956. }
  5957. var _localAutosave = localAutosave,
  5958. title = _localAutosave.post_title,
  5959. content = _localAutosave.content,
  5960. excerpt = _localAutosave.excerpt;
  5961. var edits = {
  5962. title: title,
  5963. content: content,
  5964. excerpt: excerpt
  5965. };
  5966. {
  5967. // Only display a notice if there is a difference between what has been
  5968. // saved and that which is stored in sessionStorage.
  5969. var hasDifference = Object.keys(edits).some(function (key) {
  5970. return edits[key] !== getEditedPostAttribute(key);
  5971. });
  5972. if (!hasDifference) {
  5973. // If there is no difference, it can be safely ejected from storage.
  5974. localAutosaveClear(postId);
  5975. return;
  5976. }
  5977. }
  5978. if (remoteAutosave) {
  5979. return;
  5980. }
  5981. var noticeId = Object(external_lodash_["uniqueId"])('wpEditorAutosaveRestore');
  5982. createWarningNotice(Object(external_this_wp_i18n_["__"])('The backup of this post in your browser is different from the version below.'), {
  5983. id: noticeId,
  5984. actions: [{
  5985. label: Object(external_this_wp_i18n_["__"])('Restore the backup'),
  5986. onClick: function onClick() {
  5987. editPost(Object(external_lodash_["omit"])(edits, ['content']));
  5988. resetEditorBlocks(Object(external_this_wp_blocks_["parse"])(edits.content));
  5989. removeNotice(noticeId);
  5990. }
  5991. }]
  5992. });
  5993. }, [postId, hasFetchedAutosave]);
  5994. }
  5995. /**
  5996. * Custom hook which ejects a local autosave after a successful save occurs.
  5997. */
  5998. function useAutosavePurge() {
  5999. var _useSelect2 = Object(external_this_wp_data_["useSelect"])(function (select) {
  6000. return {
  6001. postId: select('core/editor').getCurrentPostId(),
  6002. postType: select('core/editor').getCurrentPostType(),
  6003. isDirty: select('core/editor').isEditedPostDirty(),
  6004. isAutosaving: select('core/editor').isAutosavingPost(),
  6005. didError: select('core/editor').didPostSaveRequestFail()
  6006. };
  6007. }),
  6008. postId = _useSelect2.postId,
  6009. isDirty = _useSelect2.isDirty,
  6010. isAutosaving = _useSelect2.isAutosaving,
  6011. didError = _useSelect2.didError;
  6012. var lastIsDirty = Object(external_this_wp_element_["useRef"])(isDirty);
  6013. var lastIsAutosaving = Object(external_this_wp_element_["useRef"])(isAutosaving);
  6014. Object(external_this_wp_element_["useEffect"])(function () {
  6015. if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) {
  6016. localAutosaveClear(postId);
  6017. }
  6018. lastIsDirty.current = isDirty;
  6019. lastIsAutosaving.current = isAutosaving;
  6020. }, [isDirty, isAutosaving, didError]);
  6021. }
  6022. function LocalAutosaveMonitor() {
  6023. var _useDispatch3 = Object(external_this_wp_data_["useDispatch"])('core/editor'),
  6024. __experimentalLocalAutosave = _useDispatch3.__experimentalLocalAutosave;
  6025. var autosave = Object(external_this_wp_element_["useCallback"])(function () {
  6026. requestIdleCallback(__experimentalLocalAutosave);
  6027. }, []);
  6028. useAutosaveNotice();
  6029. useAutosavePurge();
  6030. var _useSelect3 = Object(external_this_wp_data_["useSelect"])(function (select) {
  6031. return {
  6032. localAutosaveInterval: select('core/editor').getEditorSettings().__experimentalLocalAutosaveInterval
  6033. };
  6034. }),
  6035. localAutosaveInterval = _useSelect3.localAutosaveInterval;
  6036. return Object(external_this_wp_element_["createElement"])(autosave_monitor, {
  6037. interval: localAutosaveInterval,
  6038. autosave: autosave,
  6039. shouldThrottle: true
  6040. });
  6041. }
  6042. /* harmony default export */ var local_autosave_monitor = (Object(external_this_wp_compose_["ifCondition"])(hasSessionStorageSupport)(LocalAutosaveMonitor));
  6043. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js
  6044. /**
  6045. * External dependencies
  6046. */
  6047. /**
  6048. * WordPress dependencies
  6049. */
  6050. function PageAttributesCheck(_ref) {
  6051. var availableTemplates = _ref.availableTemplates,
  6052. postType = _ref.postType,
  6053. children = _ref.children;
  6054. var supportsPageAttributes = Object(external_lodash_["get"])(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist.
  6055. if (!supportsPageAttributes && Object(external_lodash_["isEmpty"])(availableTemplates)) {
  6056. return null;
  6057. }
  6058. return children;
  6059. }
  6060. /* harmony default export */ var page_attributes_check = (Object(external_this_wp_data_["withSelect"])(function (select) {
  6061. var _select = select('core/editor'),
  6062. getEditedPostAttribute = _select.getEditedPostAttribute,
  6063. getEditorSettings = _select.getEditorSettings;
  6064. var _select2 = select('core'),
  6065. getPostType = _select2.getPostType;
  6066. var _getEditorSettings = getEditorSettings(),
  6067. availableTemplates = _getEditorSettings.availableTemplates;
  6068. return {
  6069. postType: getPostType(getEditedPostAttribute('type')),
  6070. availableTemplates: availableTemplates
  6071. };
  6072. })(PageAttributesCheck));
  6073. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js
  6074. /**
  6075. * External dependencies
  6076. */
  6077. /**
  6078. * WordPress dependencies
  6079. */
  6080. /**
  6081. * A component which renders its own children only if the current editor post
  6082. * type supports one of the given `supportKeys` prop.
  6083. *
  6084. * @param {Object} props
  6085. * @param {string} [props.postType] Current post type.
  6086. * @param {WPElement} props.children Children to be rendered if post
  6087. * type supports.
  6088. * @param {(string|string[])} props.supportKeys String or string array of keys
  6089. * to test.
  6090. *
  6091. * @return {WPElement} Rendered element.
  6092. */
  6093. function PostTypeSupportCheck(_ref) {
  6094. var postType = _ref.postType,
  6095. children = _ref.children,
  6096. supportKeys = _ref.supportKeys;
  6097. var isSupported = true;
  6098. if (postType) {
  6099. isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), function (key) {
  6100. return !!postType.supports[key];
  6101. });
  6102. }
  6103. if (!isSupported) {
  6104. return null;
  6105. }
  6106. return children;
  6107. }
  6108. /* harmony default export */ var post_type_support_check = (Object(external_this_wp_data_["withSelect"])(function (select) {
  6109. var _select = select('core/editor'),
  6110. getEditedPostAttribute = _select.getEditedPostAttribute;
  6111. var _select2 = select('core'),
  6112. getPostType = _select2.getPostType;
  6113. return {
  6114. postType: getPostType(getEditedPostAttribute('type'))
  6115. };
  6116. })(PostTypeSupportCheck));
  6117. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js
  6118. /**
  6119. * External dependencies
  6120. */
  6121. /**
  6122. * WordPress dependencies
  6123. */
  6124. /**
  6125. * Internal dependencies
  6126. */
  6127. var PageAttributesOrder = Object(external_this_wp_compose_["withState"])({
  6128. orderInput: null
  6129. })(function (_ref) {
  6130. var onUpdateOrder = _ref.onUpdateOrder,
  6131. _ref$order = _ref.order,
  6132. order = _ref$order === void 0 ? 0 : _ref$order,
  6133. orderInput = _ref.orderInput,
  6134. setState = _ref.setState;
  6135. var setUpdatedOrder = function setUpdatedOrder(value) {
  6136. setState({
  6137. orderInput: value
  6138. });
  6139. var newOrder = Number(value);
  6140. if (Number.isInteger(newOrder) && Object(external_lodash_["invoke"])(value, ['trim']) !== '') {
  6141. onUpdateOrder(Number(value));
  6142. }
  6143. };
  6144. var value = orderInput === null ? order : orderInput;
  6145. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], {
  6146. className: "editor-page-attributes__order",
  6147. type: "number",
  6148. label: Object(external_this_wp_i18n_["__"])('Order'),
  6149. value: value,
  6150. onChange: setUpdatedOrder,
  6151. size: 6,
  6152. onBlur: function onBlur() {
  6153. setState({
  6154. orderInput: null
  6155. });
  6156. }
  6157. });
  6158. });
  6159. function PageAttributesOrderWithChecks(props) {
  6160. return Object(external_this_wp_element_["createElement"])(post_type_support_check, {
  6161. supportKeys: "page-attributes"
  6162. }, Object(external_this_wp_element_["createElement"])(PageAttributesOrder, props));
  6163. }
  6164. /* harmony default export */ var page_attributes_order = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  6165. return {
  6166. order: select('core/editor').getEditedPostAttribute('menu_order')
  6167. };
  6168. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  6169. return {
  6170. onUpdateOrder: function onUpdateOrder(order) {
  6171. dispatch('core/editor').editPost({
  6172. menu_order: order
  6173. });
  6174. }
  6175. };
  6176. })])(PageAttributesOrderWithChecks));
  6177. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js
  6178. /**
  6179. * External dependencies
  6180. */
  6181. /**
  6182. * Returns terms in a tree form.
  6183. *
  6184. * @param {Array} flatTerms Array of terms in flat format.
  6185. *
  6186. * @return {Array} Array of terms in tree format.
  6187. */
  6188. function buildTermsTree(flatTerms) {
  6189. var flatTermsWithParentAndChildren = flatTerms.map(function (term) {
  6190. return Object(objectSpread["a" /* default */])({
  6191. children: [],
  6192. parent: null
  6193. }, term);
  6194. });
  6195. var termsByParent = Object(external_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent');
  6196. if (termsByParent.null && termsByParent.null.length) {
  6197. return flatTermsWithParentAndChildren;
  6198. }
  6199. var fillWithChildren = function fillWithChildren(terms) {
  6200. return terms.map(function (term) {
  6201. var children = termsByParent[term.id];
  6202. return Object(objectSpread["a" /* default */])({}, term, {
  6203. children: children && children.length ? fillWithChildren(children) : []
  6204. });
  6205. });
  6206. };
  6207. return fillWithChildren(termsByParent['0'] || []);
  6208. }
  6209. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js
  6210. /**
  6211. * External dependencies
  6212. */
  6213. /**
  6214. * WordPress dependencies
  6215. */
  6216. /**
  6217. * Internal dependencies
  6218. */
  6219. function PageAttributesParent(_ref) {
  6220. var parent = _ref.parent,
  6221. postType = _ref.postType,
  6222. items = _ref.items,
  6223. onUpdateParent = _ref.onUpdateParent;
  6224. var isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false);
  6225. var parentPageLabel = Object(external_lodash_["get"])(postType, ['labels', 'parent_item_colon']);
  6226. var pageItems = items || [];
  6227. if (!isHierarchical || !parentPageLabel || !pageItems.length) {
  6228. return null;
  6229. }
  6230. var pagesTree = buildTermsTree(pageItems.map(function (item) {
  6231. return {
  6232. id: item.id,
  6233. parent: item.parent,
  6234. name: item.title.raw ? item.title.raw : "#".concat(item.id, " (").concat(Object(external_this_wp_i18n_["__"])('no title'), ")")
  6235. };
  6236. }));
  6237. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TreeSelect"], {
  6238. className: "editor-page-attributes__parent",
  6239. label: parentPageLabel,
  6240. noOptionLabel: "(".concat(Object(external_this_wp_i18n_["__"])('no parent'), ")"),
  6241. tree: pagesTree,
  6242. selectedId: parent,
  6243. onChange: onUpdateParent
  6244. });
  6245. }
  6246. var applyWithSelect = Object(external_this_wp_data_["withSelect"])(function (select) {
  6247. var _select = select('core'),
  6248. getPostType = _select.getPostType,
  6249. getEntityRecords = _select.getEntityRecords;
  6250. var _select2 = select('core/editor'),
  6251. getCurrentPostId = _select2.getCurrentPostId,
  6252. getEditedPostAttribute = _select2.getEditedPostAttribute;
  6253. var postTypeSlug = getEditedPostAttribute('type');
  6254. var postType = getPostType(postTypeSlug);
  6255. var postId = getCurrentPostId();
  6256. var isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false);
  6257. var query = {
  6258. per_page: -1,
  6259. exclude: postId,
  6260. parent_exclude: postId,
  6261. orderby: 'menu_order',
  6262. order: 'asc'
  6263. };
  6264. return {
  6265. parent: getEditedPostAttribute('parent'),
  6266. items: isHierarchical ? getEntityRecords('postType', postTypeSlug, query) : [],
  6267. postType: postType
  6268. };
  6269. });
  6270. var applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  6271. var _dispatch = dispatch('core/editor'),
  6272. editPost = _dispatch.editPost;
  6273. return {
  6274. onUpdateParent: function onUpdateParent(parent) {
  6275. editPost({
  6276. parent: parent || 0
  6277. });
  6278. }
  6279. };
  6280. });
  6281. /* harmony default export */ var page_attributes_parent = (Object(external_this_wp_compose_["compose"])([applyWithSelect, applyWithDispatch])(PageAttributesParent));
  6282. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/template.js
  6283. /**
  6284. * External dependencies
  6285. */
  6286. /**
  6287. * WordPress dependencies
  6288. */
  6289. function PageTemplate(_ref) {
  6290. var availableTemplates = _ref.availableTemplates,
  6291. selectedTemplate = _ref.selectedTemplate,
  6292. onUpdate = _ref.onUpdate;
  6293. if (Object(external_lodash_["isEmpty"])(availableTemplates)) {
  6294. return null;
  6295. }
  6296. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SelectControl"], {
  6297. label: Object(external_this_wp_i18n_["__"])('Template:'),
  6298. value: selectedTemplate,
  6299. onChange: onUpdate,
  6300. className: "editor-page-attributes__template",
  6301. options: Object(external_lodash_["map"])(availableTemplates, function (templateName, templateSlug) {
  6302. return {
  6303. value: templateSlug,
  6304. label: templateName
  6305. };
  6306. })
  6307. });
  6308. }
  6309. /* harmony default export */ var page_attributes_template = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) {
  6310. var _select = select('core/editor'),
  6311. getEditedPostAttribute = _select.getEditedPostAttribute,
  6312. getEditorSettings = _select.getEditorSettings;
  6313. var _getEditorSettings = getEditorSettings(),
  6314. availableTemplates = _getEditorSettings.availableTemplates;
  6315. return {
  6316. selectedTemplate: getEditedPostAttribute('template'),
  6317. availableTemplates: availableTemplates
  6318. };
  6319. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  6320. return {
  6321. onUpdate: function onUpdate(templateSlug) {
  6322. dispatch('core/editor').editPost({
  6323. template: templateSlug || ''
  6324. });
  6325. }
  6326. };
  6327. }))(PageTemplate));
  6328. // EXTERNAL MODULE: external {"this":["wp","htmlEntities"]}
  6329. var external_this_wp_htmlEntities_ = __webpack_require__(52);
  6330. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js
  6331. /**
  6332. * External dependencies
  6333. */
  6334. /**
  6335. * WordPress dependencies
  6336. */
  6337. /**
  6338. * Internal dependencies
  6339. */
  6340. function PostAuthorCheck(_ref) {
  6341. var hasAssignAuthorAction = _ref.hasAssignAuthorAction,
  6342. authors = _ref.authors,
  6343. children = _ref.children;
  6344. if (!hasAssignAuthorAction || authors.length < 2) {
  6345. return null;
  6346. }
  6347. return Object(external_this_wp_element_["createElement"])(post_type_support_check, {
  6348. supportKeys: "author"
  6349. }, children);
  6350. }
  6351. /* harmony default export */ var post_author_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  6352. var post = select('core/editor').getCurrentPost();
  6353. return {
  6354. hasAssignAuthorAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-assign-author'], false),
  6355. postType: select('core/editor').getCurrentPostType(),
  6356. authors: select('core').getAuthors()
  6357. };
  6358. }), external_this_wp_compose_["withInstanceId"]])(PostAuthorCheck));
  6359. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js
  6360. /**
  6361. * WordPress dependencies
  6362. */
  6363. /**
  6364. * Internal dependencies
  6365. */
  6366. var post_author_PostAuthor =
  6367. /*#__PURE__*/
  6368. function (_Component) {
  6369. Object(inherits["a" /* default */])(PostAuthor, _Component);
  6370. function PostAuthor() {
  6371. var _this;
  6372. Object(classCallCheck["a" /* default */])(this, PostAuthor);
  6373. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostAuthor).apply(this, arguments));
  6374. _this.setAuthorId = _this.setAuthorId.bind(Object(assertThisInitialized["a" /* default */])(_this));
  6375. return _this;
  6376. }
  6377. Object(createClass["a" /* default */])(PostAuthor, [{
  6378. key: "setAuthorId",
  6379. value: function setAuthorId(event) {
  6380. var onUpdateAuthor = this.props.onUpdateAuthor;
  6381. var value = event.target.value;
  6382. onUpdateAuthor(Number(value));
  6383. }
  6384. }, {
  6385. key: "render",
  6386. value: function render() {
  6387. var _this$props = this.props,
  6388. postAuthor = _this$props.postAuthor,
  6389. instanceId = _this$props.instanceId,
  6390. authors = _this$props.authors;
  6391. var selectId = 'post-author-selector-' + instanceId; // Disable reason: A select with an onchange throws a warning
  6392. /* eslint-disable jsx-a11y/no-onchange */
  6393. return Object(external_this_wp_element_["createElement"])(post_author_check, null, Object(external_this_wp_element_["createElement"])("label", {
  6394. htmlFor: selectId
  6395. }, Object(external_this_wp_i18n_["__"])('Author')), Object(external_this_wp_element_["createElement"])("select", {
  6396. id: selectId,
  6397. value: postAuthor,
  6398. onChange: this.setAuthorId,
  6399. className: "editor-post-author__select"
  6400. }, authors.map(function (author) {
  6401. return Object(external_this_wp_element_["createElement"])("option", {
  6402. key: author.id,
  6403. value: author.id
  6404. }, Object(external_this_wp_htmlEntities_["decodeEntities"])(author.name));
  6405. })));
  6406. /* eslint-enable jsx-a11y/no-onchange */
  6407. }
  6408. }]);
  6409. return PostAuthor;
  6410. }(external_this_wp_element_["Component"]);
  6411. /* harmony default export */ var post_author = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  6412. return {
  6413. postAuthor: select('core/editor').getEditedPostAttribute('author'),
  6414. authors: select('core').getAuthors()
  6415. };
  6416. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  6417. return {
  6418. onUpdateAuthor: function onUpdateAuthor(author) {
  6419. dispatch('core/editor').editPost({
  6420. author: author
  6421. });
  6422. }
  6423. };
  6424. }), external_this_wp_compose_["withInstanceId"]])(post_author_PostAuthor));
  6425. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js
  6426. /**
  6427. * WordPress dependencies
  6428. */
  6429. function PostComments(_ref) {
  6430. var _ref$commentStatus = _ref.commentStatus,
  6431. commentStatus = _ref$commentStatus === void 0 ? 'open' : _ref$commentStatus,
  6432. props = Object(objectWithoutProperties["a" /* default */])(_ref, ["commentStatus"]);
  6433. var onToggleComments = function onToggleComments() {
  6434. return props.editPost({
  6435. comment_status: commentStatus === 'open' ? 'closed' : 'open'
  6436. });
  6437. };
  6438. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], {
  6439. label: Object(external_this_wp_i18n_["__"])('Allow Comments'),
  6440. checked: commentStatus === 'open',
  6441. onChange: onToggleComments
  6442. });
  6443. }
  6444. /* harmony default export */ var post_comments = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  6445. return {
  6446. commentStatus: select('core/editor').getEditedPostAttribute('comment_status')
  6447. };
  6448. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  6449. return {
  6450. editPost: dispatch('core/editor').editPost
  6451. };
  6452. })])(PostComments));
  6453. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js
  6454. /**
  6455. * WordPress dependencies
  6456. */
  6457. function PostExcerpt(_ref) {
  6458. var excerpt = _ref.excerpt,
  6459. onUpdateExcerpt = _ref.onUpdateExcerpt;
  6460. return Object(external_this_wp_element_["createElement"])("div", {
  6461. className: "editor-post-excerpt"
  6462. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextareaControl"], {
  6463. label: Object(external_this_wp_i18n_["__"])('Write an excerpt (optional)'),
  6464. className: "editor-post-excerpt__textarea",
  6465. onChange: function onChange(value) {
  6466. return onUpdateExcerpt(value);
  6467. },
  6468. value: excerpt
  6469. }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], {
  6470. href: Object(external_this_wp_i18n_["__"])('https://codex.wordpress.org/Excerpt')
  6471. }, Object(external_this_wp_i18n_["__"])('Learn more about manual excerpts')));
  6472. }
  6473. /* harmony default export */ var post_excerpt = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  6474. return {
  6475. excerpt: select('core/editor').getEditedPostAttribute('excerpt')
  6476. };
  6477. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  6478. return {
  6479. onUpdateExcerpt: function onUpdateExcerpt(excerpt) {
  6480. dispatch('core/editor').editPost({
  6481. excerpt: excerpt
  6482. });
  6483. }
  6484. };
  6485. })])(PostExcerpt));
  6486. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  6487. var esm_extends = __webpack_require__(18);
  6488. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js
  6489. /**
  6490. * Internal dependencies
  6491. */
  6492. function PostExcerptCheck(props) {
  6493. return Object(external_this_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, {
  6494. supportKeys: "excerpt"
  6495. }));
  6496. }
  6497. /* harmony default export */ var post_excerpt_check = (PostExcerptCheck);
  6498. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js
  6499. /**
  6500. * External dependencies
  6501. */
  6502. /**
  6503. * WordPress dependencies
  6504. */
  6505. function ThemeSupportCheck(_ref) {
  6506. var themeSupports = _ref.themeSupports,
  6507. children = _ref.children,
  6508. postType = _ref.postType,
  6509. supportKeys = _ref.supportKeys;
  6510. var isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), function (key) {
  6511. var supported = Object(external_lodash_["get"])(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types.
  6512. // In the latter case, we need to verify `postType` exists
  6513. // within `supported`. If `postType` isn't passed, then the check
  6514. // should fail.
  6515. if ('post-thumbnails' === key && Object(external_lodash_["isArray"])(supported)) {
  6516. return Object(external_lodash_["includes"])(supported, postType);
  6517. }
  6518. return supported;
  6519. });
  6520. if (!isSupported) {
  6521. return null;
  6522. }
  6523. return children;
  6524. }
  6525. /* harmony default export */ var theme_support_check = (Object(external_this_wp_data_["withSelect"])(function (select) {
  6526. var _select = select('core'),
  6527. getThemeSupports = _select.getThemeSupports;
  6528. var _select2 = select('core/editor'),
  6529. getEditedPostAttribute = _select2.getEditedPostAttribute;
  6530. return {
  6531. postType: getEditedPostAttribute('type'),
  6532. themeSupports: getThemeSupports()
  6533. };
  6534. })(ThemeSupportCheck));
  6535. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js
  6536. /**
  6537. * Internal dependencies
  6538. */
  6539. function PostFeaturedImageCheck(props) {
  6540. return Object(external_this_wp_element_["createElement"])(theme_support_check, {
  6541. supportKeys: "post-thumbnails"
  6542. }, Object(external_this_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, {
  6543. supportKeys: "thumbnail"
  6544. })));
  6545. }
  6546. /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck);
  6547. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js
  6548. /**
  6549. * External dependencies
  6550. */
  6551. /**
  6552. * WordPress dependencies
  6553. */
  6554. /**
  6555. * Internal dependencies
  6556. */
  6557. var ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present.
  6558. var DEFAULT_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Featured Image');
  6559. var DEFAULT_SET_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Set Featured Image');
  6560. var DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Remove Image');
  6561. function PostFeaturedImage(_ref) {
  6562. var currentPostId = _ref.currentPostId,
  6563. featuredImageId = _ref.featuredImageId,
  6564. onUpdateImage = _ref.onUpdateImage,
  6565. onRemoveImage = _ref.onRemoveImage,
  6566. media = _ref.media,
  6567. postType = _ref.postType;
  6568. var postLabel = Object(external_lodash_["get"])(postType, ['labels'], {});
  6569. var instructions = Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('To edit the featured image, you need permission to upload media.'));
  6570. var mediaWidth, mediaHeight, mediaSourceUrl;
  6571. if (media) {
  6572. var mediaSize = Object(external_this_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId);
  6573. if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', mediaSize])) {
  6574. mediaWidth = media.media_details.sizes[mediaSize].width;
  6575. mediaHeight = media.media_details.sizes[mediaSize].height;
  6576. mediaSourceUrl = media.media_details.sizes[mediaSize].source_url;
  6577. } else {
  6578. mediaWidth = media.media_details.width;
  6579. mediaHeight = media.media_details.height;
  6580. mediaSourceUrl = media.source_url;
  6581. }
  6582. }
  6583. return Object(external_this_wp_element_["createElement"])(post_featured_image_check, null, Object(external_this_wp_element_["createElement"])("div", {
  6584. className: "editor-post-featured-image"
  6585. }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], {
  6586. fallback: instructions
  6587. }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUpload"], {
  6588. title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
  6589. onSelect: onUpdateImage,
  6590. unstableFeaturedImageFlow: true,
  6591. allowedTypes: ALLOWED_MEDIA_TYPES,
  6592. modalClass: !featuredImageId ? 'editor-post-featured-image__media-modal' : 'editor-post-featured-image__media-modal',
  6593. render: function render(_ref2) {
  6594. var open = _ref2.open;
  6595. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  6596. className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
  6597. onClick: open,
  6598. "aria-label": !featuredImageId ? null : Object(external_this_wp_i18n_["__"])('Edit or update the image')
  6599. }, !!featuredImageId && media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ResponsiveWrapper"], {
  6600. naturalWidth: mediaWidth,
  6601. naturalHeight: mediaHeight,
  6602. isInline: true
  6603. }, Object(external_this_wp_element_["createElement"])("img", {
  6604. src: mediaSourceUrl,
  6605. alt: ""
  6606. })), !!featuredImageId && !media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL));
  6607. },
  6608. value: featuredImageId
  6609. })), !!featuredImageId && media && !media.isLoading && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUpload"], {
  6610. title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
  6611. onSelect: onUpdateImage,
  6612. unstableFeaturedImageFlow: true,
  6613. allowedTypes: ALLOWED_MEDIA_TYPES,
  6614. modalClass: "editor-post-featured-image__media-modal",
  6615. render: function render(_ref3) {
  6616. var open = _ref3.open;
  6617. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  6618. onClick: open,
  6619. isDefault: true,
  6620. isLarge: true
  6621. }, Object(external_this_wp_i18n_["__"])('Replace Image'));
  6622. }
  6623. })), !!featuredImageId && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  6624. onClick: onRemoveImage,
  6625. isLink: true,
  6626. isDestructive: true
  6627. }, postLabel.remove_featured_image || DEFAULT_REMOVE_FEATURE_IMAGE_LABEL))));
  6628. }
  6629. var post_featured_image_applyWithSelect = Object(external_this_wp_data_["withSelect"])(function (select) {
  6630. var _select = select('core'),
  6631. getMedia = _select.getMedia,
  6632. getPostType = _select.getPostType;
  6633. var _select2 = select('core/editor'),
  6634. getCurrentPostId = _select2.getCurrentPostId,
  6635. getEditedPostAttribute = _select2.getEditedPostAttribute;
  6636. var featuredImageId = getEditedPostAttribute('featured_media');
  6637. return {
  6638. media: featuredImageId ? getMedia(featuredImageId) : null,
  6639. currentPostId: getCurrentPostId(),
  6640. postType: getPostType(getEditedPostAttribute('type')),
  6641. featuredImageId: featuredImageId
  6642. };
  6643. });
  6644. var post_featured_image_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  6645. var _dispatch = dispatch('core/editor'),
  6646. editPost = _dispatch.editPost;
  6647. return {
  6648. onUpdateImage: function onUpdateImage(image) {
  6649. editPost({
  6650. featured_media: image.id
  6651. });
  6652. },
  6653. onRemoveImage: function onRemoveImage() {
  6654. editPost({
  6655. featured_media: 0
  6656. });
  6657. }
  6658. };
  6659. });
  6660. /* harmony default export */ var post_featured_image = (Object(external_this_wp_compose_["compose"])(post_featured_image_applyWithSelect, post_featured_image_applyWithDispatch, Object(external_this_wp_components_["withFilters"])('editor.PostFeaturedImage'))(PostFeaturedImage));
  6661. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js
  6662. /**
  6663. * WordPress dependencies
  6664. */
  6665. /**
  6666. * Internal dependencies
  6667. */
  6668. function PostFormatCheck(_ref) {
  6669. var disablePostFormats = _ref.disablePostFormats,
  6670. props = Object(objectWithoutProperties["a" /* default */])(_ref, ["disablePostFormats"]);
  6671. return !disablePostFormats && Object(external_this_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, {
  6672. supportKeys: "post-formats"
  6673. }));
  6674. }
  6675. /* harmony default export */ var post_format_check = (Object(external_this_wp_data_["withSelect"])(function (select) {
  6676. var editorSettings = select('core/editor').getEditorSettings();
  6677. return {
  6678. disablePostFormats: editorSettings.disablePostFormats
  6679. };
  6680. })(PostFormatCheck));
  6681. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js
  6682. /**
  6683. * External dependencies
  6684. */
  6685. /**
  6686. * WordPress dependencies
  6687. */
  6688. /**
  6689. * Internal dependencies
  6690. */
  6691. var POST_FORMATS = [{
  6692. id: 'aside',
  6693. caption: Object(external_this_wp_i18n_["__"])('Aside')
  6694. }, {
  6695. id: 'gallery',
  6696. caption: Object(external_this_wp_i18n_["__"])('Gallery')
  6697. }, {
  6698. id: 'link',
  6699. caption: Object(external_this_wp_i18n_["__"])('Link')
  6700. }, {
  6701. id: 'image',
  6702. caption: Object(external_this_wp_i18n_["__"])('Image')
  6703. }, {
  6704. id: 'quote',
  6705. caption: Object(external_this_wp_i18n_["__"])('Quote')
  6706. }, {
  6707. id: 'standard',
  6708. caption: Object(external_this_wp_i18n_["__"])('Standard')
  6709. }, {
  6710. id: 'status',
  6711. caption: Object(external_this_wp_i18n_["__"])('Status')
  6712. }, {
  6713. id: 'video',
  6714. caption: Object(external_this_wp_i18n_["__"])('Video')
  6715. }, {
  6716. id: 'audio',
  6717. caption: Object(external_this_wp_i18n_["__"])('Audio')
  6718. }, {
  6719. id: 'chat',
  6720. caption: Object(external_this_wp_i18n_["__"])('Chat')
  6721. }];
  6722. function PostFormat(_ref) {
  6723. var onUpdatePostFormat = _ref.onUpdatePostFormat,
  6724. _ref$postFormat = _ref.postFormat,
  6725. postFormat = _ref$postFormat === void 0 ? 'standard' : _ref$postFormat,
  6726. supportedFormats = _ref.supportedFormats,
  6727. suggestedFormat = _ref.suggestedFormat,
  6728. instanceId = _ref.instanceId;
  6729. var postFormatSelectorId = 'post-format-selector-' + instanceId;
  6730. var formats = POST_FORMATS.filter(function (format) {
  6731. return Object(external_lodash_["includes"])(supportedFormats, format.id);
  6732. });
  6733. var suggestion = Object(external_lodash_["find"])(formats, function (format) {
  6734. return format.id === suggestedFormat;
  6735. }); // Disable reason: We need to change the value immiediately to show/hide the suggestion if needed
  6736. return Object(external_this_wp_element_["createElement"])(post_format_check, null, Object(external_this_wp_element_["createElement"])("div", {
  6737. className: "editor-post-format"
  6738. }, Object(external_this_wp_element_["createElement"])("div", {
  6739. className: "editor-post-format__content"
  6740. }, Object(external_this_wp_element_["createElement"])("label", {
  6741. htmlFor: postFormatSelectorId
  6742. }, Object(external_this_wp_i18n_["__"])('Post Format')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SelectControl"], {
  6743. value: postFormat,
  6744. onChange: function onChange(format) {
  6745. return onUpdatePostFormat(format);
  6746. },
  6747. id: postFormatSelectorId,
  6748. options: formats.map(function (format) {
  6749. return {
  6750. label: format.caption,
  6751. value: format.id
  6752. };
  6753. })
  6754. })), suggestion && suggestion.id !== postFormat && Object(external_this_wp_element_["createElement"])("div", {
  6755. className: "editor-post-format__suggestion"
  6756. }, Object(external_this_wp_i18n_["__"])('Suggestion:'), ' ', Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  6757. isLink: true,
  6758. onClick: function onClick() {
  6759. return onUpdatePostFormat(suggestion.id);
  6760. }
  6761. }, suggestion.caption))));
  6762. }
  6763. /* harmony default export */ var post_format = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  6764. var _select = select('core/editor'),
  6765. getEditedPostAttribute = _select.getEditedPostAttribute,
  6766. getSuggestedPostFormat = _select.getSuggestedPostFormat;
  6767. var postFormat = getEditedPostAttribute('format');
  6768. var themeSupports = select('core').getThemeSupports(); // Ensure current format is always in the set.
  6769. // The current format may not be a format supported by the theme.
  6770. var supportedFormats = Object(external_lodash_["union"])([postFormat], Object(external_lodash_["get"])(themeSupports, ['formats'], []));
  6771. return {
  6772. postFormat: postFormat,
  6773. supportedFormats: supportedFormats,
  6774. suggestedFormat: getSuggestedPostFormat()
  6775. };
  6776. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  6777. return {
  6778. onUpdatePostFormat: function onUpdatePostFormat(postFormat) {
  6779. dispatch('core/editor').editPost({
  6780. format: postFormat
  6781. });
  6782. }
  6783. };
  6784. }), external_this_wp_compose_["withInstanceId"]])(PostFormat));
  6785. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js
  6786. /**
  6787. * WordPress dependencies
  6788. */
  6789. /**
  6790. * Internal dependencies
  6791. */
  6792. function PostLastRevisionCheck(_ref) {
  6793. var lastRevisionId = _ref.lastRevisionId,
  6794. revisionsCount = _ref.revisionsCount,
  6795. children = _ref.children;
  6796. if (!lastRevisionId || revisionsCount < 2) {
  6797. return null;
  6798. }
  6799. return Object(external_this_wp_element_["createElement"])(post_type_support_check, {
  6800. supportKeys: "revisions"
  6801. }, children);
  6802. }
  6803. /* harmony default export */ var post_last_revision_check = (Object(external_this_wp_data_["withSelect"])(function (select) {
  6804. var _select = select('core/editor'),
  6805. getCurrentPostLastRevisionId = _select.getCurrentPostLastRevisionId,
  6806. getCurrentPostRevisionsCount = _select.getCurrentPostRevisionsCount;
  6807. return {
  6808. lastRevisionId: getCurrentPostLastRevisionId(),
  6809. revisionsCount: getCurrentPostRevisionsCount()
  6810. };
  6811. })(PostLastRevisionCheck));
  6812. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js
  6813. /**
  6814. * External dependencies
  6815. */
  6816. /**
  6817. * WordPress dependencies
  6818. */
  6819. /**
  6820. * Returns the URL of a WPAdmin Page.
  6821. *
  6822. * TODO: This should be moved to a module less specific to the editor.
  6823. *
  6824. * @param {string} page Page to navigate to.
  6825. * @param {Object} query Query Args.
  6826. *
  6827. * @return {string} WPAdmin URL.
  6828. */
  6829. function getWPAdminURL(page, query) {
  6830. return Object(external_this_wp_url_["addQueryArgs"])(page, query);
  6831. }
  6832. /**
  6833. * Performs some basic cleanup of a string for use as a post slug
  6834. *
  6835. * This replicates some of what sanitize_title() does in WordPress core, but
  6836. * is only designed to approximate what the slug will be.
  6837. *
  6838. * Converts whitespace, periods, forward slashes and underscores to hyphens.
  6839. * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin
  6840. * letters. Removes combining diacritical marks. Converts remaining string
  6841. * to lowercase. It does not touch octets, HTML entities, or other encoded
  6842. * characters.
  6843. *
  6844. * @param {string} string Title or slug to be processed
  6845. *
  6846. * @return {string} Processed string
  6847. */
  6848. function cleanForSlug(string) {
  6849. if (!string) {
  6850. return '';
  6851. }
  6852. return Object(external_lodash_["toLower"])(Object(external_lodash_["deburr"])(Object(external_lodash_["trim"])(string.replace(/[\s\./_]+/g, '-'), '-')));
  6853. }
  6854. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js
  6855. /**
  6856. * WordPress dependencies
  6857. */
  6858. /**
  6859. * Internal dependencies
  6860. */
  6861. function LastRevision(_ref) {
  6862. var lastRevisionId = _ref.lastRevisionId,
  6863. revisionsCount = _ref.revisionsCount;
  6864. return Object(external_this_wp_element_["createElement"])(post_last_revision_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], {
  6865. href: getWPAdminURL('revision.php', {
  6866. revision: lastRevisionId,
  6867. gutenberg: true
  6868. }),
  6869. className: "editor-post-last-revision__title",
  6870. icon: "backup"
  6871. }, Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d Revision', '%d Revisions', revisionsCount), revisionsCount)));
  6872. }
  6873. /* harmony default export */ var post_last_revision = (Object(external_this_wp_data_["withSelect"])(function (select) {
  6874. var _select = select('core/editor'),
  6875. getCurrentPostLastRevisionId = _select.getCurrentPostLastRevisionId,
  6876. getCurrentPostRevisionsCount = _select.getCurrentPostRevisionsCount;
  6877. return {
  6878. lastRevisionId: getCurrentPostLastRevisionId(),
  6879. revisionsCount: getCurrentPostRevisionsCount()
  6880. };
  6881. })(LastRevision));
  6882. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js
  6883. /**
  6884. * External dependencies
  6885. */
  6886. /**
  6887. * WordPress dependencies
  6888. */
  6889. function writeInterstitialMessage(targetDocument) {
  6890. var markup = Object(external_this_wp_element_["renderToString"])(Object(external_this_wp_element_["createElement"])("div", {
  6891. className: "editor-post-preview-button__interstitial-message"
  6892. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], {
  6893. xmlns: "http://www.w3.org/2000/svg",
  6894. viewBox: "0 0 96 96"
  6895. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], {
  6896. className: "outer",
  6897. d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",
  6898. fill: "none"
  6899. }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], {
  6900. className: "inner",
  6901. d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",
  6902. fill: "none"
  6903. })), Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('Generating preview…'))));
  6904. markup += "\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\t\t}\n\t\t</style>\n\t";
  6905. /**
  6906. * Filters the interstitial message shown when generating previews.
  6907. *
  6908. * @param {string} markup The preview interstitial markup.
  6909. */
  6910. markup = Object(external_this_wp_hooks_["applyFilters"])('editor.PostPreview.interstitialMarkup', markup);
  6911. targetDocument.write(markup);
  6912. targetDocument.title = Object(external_this_wp_i18n_["__"])('Generating preview…');
  6913. targetDocument.close();
  6914. }
  6915. var post_preview_button_PostPreviewButton =
  6916. /*#__PURE__*/
  6917. function (_Component) {
  6918. Object(inherits["a" /* default */])(PostPreviewButton, _Component);
  6919. function PostPreviewButton() {
  6920. var _this;
  6921. Object(classCallCheck["a" /* default */])(this, PostPreviewButton);
  6922. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPreviewButton).apply(this, arguments));
  6923. _this.openPreviewWindow = _this.openPreviewWindow.bind(Object(assertThisInitialized["a" /* default */])(_this));
  6924. return _this;
  6925. }
  6926. Object(createClass["a" /* default */])(PostPreviewButton, [{
  6927. key: "componentDidUpdate",
  6928. value: function componentDidUpdate(prevProps) {
  6929. var previewLink = this.props.previewLink; // This relies on the window being responsible to unset itself when
  6930. // navigation occurs or a new preview window is opened, to avoid
  6931. // unintentional forceful redirects.
  6932. if (previewLink && !prevProps.previewLink) {
  6933. this.setPreviewWindowLink(previewLink);
  6934. }
  6935. }
  6936. /**
  6937. * Sets the preview window's location to the given URL, if a preview window
  6938. * exists and is not closed.
  6939. *
  6940. * @param {string} url URL to assign as preview window location.
  6941. */
  6942. }, {
  6943. key: "setPreviewWindowLink",
  6944. value: function setPreviewWindowLink(url) {
  6945. var previewWindow = this.previewWindow;
  6946. if (previewWindow && !previewWindow.closed) {
  6947. previewWindow.location = url;
  6948. }
  6949. }
  6950. }, {
  6951. key: "getWindowTarget",
  6952. value: function getWindowTarget() {
  6953. var postId = this.props.postId;
  6954. return "wp-preview-".concat(postId);
  6955. }
  6956. }, {
  6957. key: "openPreviewWindow",
  6958. value: function openPreviewWindow(event) {
  6959. // Our Preview button has its 'href' and 'target' set correctly for a11y
  6960. // purposes. Unfortunately, though, we can't rely on the default 'click'
  6961. // handler since sometimes it incorrectly opens a new tab instead of reusing
  6962. // the existing one.
  6963. // https://github.com/WordPress/gutenberg/pull/8330
  6964. event.preventDefault(); // Open up a Preview tab if needed. This is where we'll show the preview.
  6965. if (!this.previewWindow || this.previewWindow.closed) {
  6966. this.previewWindow = window.open('', this.getWindowTarget());
  6967. } // Focus the Preview tab. This might not do anything, depending on the browser's
  6968. // and user's preferences.
  6969. // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus
  6970. this.previewWindow.focus(); // If we don't need to autosave the post before previewing, then we simply
  6971. // load the Preview URL in the Preview tab.
  6972. if (!this.props.isAutosaveable) {
  6973. this.setPreviewWindowLink(event.target.href);
  6974. return;
  6975. } // Request an autosave. This happens asynchronously and causes the component
  6976. // to update when finished.
  6977. if (this.props.isDraft) {
  6978. this.props.savePost({
  6979. isPreview: true
  6980. });
  6981. } else {
  6982. this.props.autosave({
  6983. isPreview: true
  6984. });
  6985. } // Display a 'Generating preview' message in the Preview tab while we wait for the
  6986. // autosave to finish.
  6987. writeInterstitialMessage(this.previewWindow.document);
  6988. }
  6989. }, {
  6990. key: "render",
  6991. value: function render() {
  6992. var _this$props = this.props,
  6993. previewLink = _this$props.previewLink,
  6994. currentPostLink = _this$props.currentPostLink,
  6995. isSaveable = _this$props.isSaveable; // Link to the `?preview=true` URL if we have it, since this lets us see
  6996. // changes that were autosaved since the post was last published. Otherwise,
  6997. // just link to the post's URL.
  6998. var href = previewLink || currentPostLink;
  6999. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  7000. isLarge: true,
  7001. className: "editor-post-preview",
  7002. href: href,
  7003. target: this.getWindowTarget(),
  7004. disabled: !isSaveable,
  7005. onClick: this.openPreviewWindow
  7006. }, Object(external_this_wp_i18n_["_x"])('Preview', 'imperative verb'), Object(external_this_wp_element_["createElement"])("span", {
  7007. className: "screen-reader-text"
  7008. },
  7009. /* translators: accessibility text */
  7010. Object(external_this_wp_i18n_["__"])('(opens in a new tab)')), Object(external_this_wp_element_["createElement"])(external_this_wp_nux_["DotTip"], {
  7011. tipId: "core/editor.preview"
  7012. }, Object(external_this_wp_i18n_["__"])('Click “Preview” to load a preview of this page, so you can make sure you’re happy with your blocks.')));
  7013. }
  7014. }]);
  7015. return PostPreviewButton;
  7016. }(external_this_wp_element_["Component"]);
  7017. /* harmony default export */ var post_preview_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref) {
  7018. var forcePreviewLink = _ref.forcePreviewLink,
  7019. forceIsAutosaveable = _ref.forceIsAutosaveable;
  7020. var _select = select('core/editor'),
  7021. getCurrentPostId = _select.getCurrentPostId,
  7022. getCurrentPostAttribute = _select.getCurrentPostAttribute,
  7023. getEditedPostAttribute = _select.getEditedPostAttribute,
  7024. isEditedPostSaveable = _select.isEditedPostSaveable,
  7025. isEditedPostAutosaveable = _select.isEditedPostAutosaveable,
  7026. getEditedPostPreviewLink = _select.getEditedPostPreviewLink;
  7027. var _select2 = select('core'),
  7028. getPostType = _select2.getPostType;
  7029. var previewLink = getEditedPostPreviewLink();
  7030. var postType = getPostType(getEditedPostAttribute('type'));
  7031. return {
  7032. postId: getCurrentPostId(),
  7033. currentPostLink: getCurrentPostAttribute('link'),
  7034. previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink,
  7035. isSaveable: isEditedPostSaveable(),
  7036. isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),
  7037. isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false),
  7038. isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1
  7039. };
  7040. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  7041. return {
  7042. autosave: dispatch('core/editor').autosave,
  7043. savePost: dispatch('core/editor').savePost
  7044. };
  7045. }), Object(external_this_wp_compose_["ifCondition"])(function (_ref2) {
  7046. var isViewable = _ref2.isViewable;
  7047. return isViewable;
  7048. })])(post_preview_button_PostPreviewButton));
  7049. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js
  7050. /**
  7051. * External dependencies
  7052. */
  7053. /**
  7054. * WordPress dependencies
  7055. */
  7056. /**
  7057. * Internal dependencies
  7058. */
  7059. var post_locked_modal_PostLockedModal =
  7060. /*#__PURE__*/
  7061. function (_Component) {
  7062. Object(inherits["a" /* default */])(PostLockedModal, _Component);
  7063. function PostLockedModal() {
  7064. var _this;
  7065. Object(classCallCheck["a" /* default */])(this, PostLockedModal);
  7066. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostLockedModal).apply(this, arguments));
  7067. _this.sendPostLock = _this.sendPostLock.bind(Object(assertThisInitialized["a" /* default */])(_this));
  7068. _this.receivePostLock = _this.receivePostLock.bind(Object(assertThisInitialized["a" /* default */])(_this));
  7069. _this.releasePostLock = _this.releasePostLock.bind(Object(assertThisInitialized["a" /* default */])(_this));
  7070. return _this;
  7071. }
  7072. Object(createClass["a" /* default */])(PostLockedModal, [{
  7073. key: "componentDidMount",
  7074. value: function componentDidMount() {
  7075. var hookName = this.getHookName(); // Details on these events on the Heartbeat API docs
  7076. // https://developer.wordpress.org/plugins/javascript/heartbeat-api/
  7077. Object(external_this_wp_hooks_["addAction"])('heartbeat.send', hookName, this.sendPostLock);
  7078. Object(external_this_wp_hooks_["addAction"])('heartbeat.tick', hookName, this.receivePostLock);
  7079. }
  7080. }, {
  7081. key: "componentWillUnmount",
  7082. value: function componentWillUnmount() {
  7083. var hookName = this.getHookName();
  7084. Object(external_this_wp_hooks_["removeAction"])('heartbeat.send', hookName);
  7085. Object(external_this_wp_hooks_["removeAction"])('heartbeat.tick', hookName);
  7086. }
  7087. /**
  7088. * Returns a `@wordpress/hooks` hook name specific to the instance of the
  7089. * component.
  7090. *
  7091. * @return {string} Hook name prefix.
  7092. */
  7093. }, {
  7094. key: "getHookName",
  7095. value: function getHookName() {
  7096. var instanceId = this.props.instanceId;
  7097. return 'core/editor/post-locked-modal-' + instanceId;
  7098. }
  7099. /**
  7100. * Keep the lock refreshed.
  7101. *
  7102. * When the user does not send a heartbeat in a heartbeat-tick
  7103. * the user is no longer editing and another user can start editing.
  7104. *
  7105. * @param {Object} data Data to send in the heartbeat request.
  7106. */
  7107. }, {
  7108. key: "sendPostLock",
  7109. value: function sendPostLock(data) {
  7110. var _this$props = this.props,
  7111. isLocked = _this$props.isLocked,
  7112. activePostLock = _this$props.activePostLock,
  7113. postId = _this$props.postId;
  7114. if (isLocked) {
  7115. return;
  7116. }
  7117. data['wp-refresh-post-lock'] = {
  7118. lock: activePostLock,
  7119. post_id: postId
  7120. };
  7121. }
  7122. /**
  7123. * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.
  7124. *
  7125. * @param {Object} data Data received in the heartbeat request
  7126. */
  7127. }, {
  7128. key: "receivePostLock",
  7129. value: function receivePostLock(data) {
  7130. if (!data['wp-refresh-post-lock']) {
  7131. return;
  7132. }
  7133. var _this$props2 = this.props,
  7134. autosave = _this$props2.autosave,
  7135. updatePostLock = _this$props2.updatePostLock;
  7136. var received = data['wp-refresh-post-lock'];
  7137. if (received.lock_error) {
  7138. // Auto save and display the takeover modal.
  7139. autosave();
  7140. updatePostLock({
  7141. isLocked: true,
  7142. isTakeover: true,
  7143. user: {
  7144. avatar: received.lock_error.avatar_src
  7145. }
  7146. });
  7147. } else if (received.new_lock) {
  7148. updatePostLock({
  7149. isLocked: false,
  7150. activePostLock: received.new_lock
  7151. });
  7152. }
  7153. }
  7154. /**
  7155. * Unlock the post before the window is exited.
  7156. */
  7157. }, {
  7158. key: "releasePostLock",
  7159. value: function releasePostLock() {
  7160. var _this$props3 = this.props,
  7161. isLocked = _this$props3.isLocked,
  7162. activePostLock = _this$props3.activePostLock,
  7163. postLockUtils = _this$props3.postLockUtils,
  7164. postId = _this$props3.postId;
  7165. if (isLocked || !activePostLock) {
  7166. return;
  7167. }
  7168. var data = new window.FormData();
  7169. data.append('action', 'wp-remove-post-lock');
  7170. data.append('_wpnonce', postLockUtils.unlockNonce);
  7171. data.append('post_ID', postId);
  7172. data.append('active_post_lock', activePostLock);
  7173. if (window.navigator.sendBeacon) {
  7174. window.navigator.sendBeacon(postLockUtils.ajaxUrl, data);
  7175. } else {
  7176. var xhr = new window.XMLHttpRequest();
  7177. xhr.open('POST', postLockUtils.ajaxUrl, false);
  7178. xhr.send(data);
  7179. }
  7180. }
  7181. }, {
  7182. key: "render",
  7183. value: function render() {
  7184. var _this$props4 = this.props,
  7185. user = _this$props4.user,
  7186. postId = _this$props4.postId,
  7187. isLocked = _this$props4.isLocked,
  7188. isTakeover = _this$props4.isTakeover,
  7189. postLockUtils = _this$props4.postLockUtils,
  7190. postType = _this$props4.postType;
  7191. if (!isLocked) {
  7192. return null;
  7193. }
  7194. var userDisplayName = user.name;
  7195. var userAvatar = user.avatar;
  7196. var unlockUrl = Object(external_this_wp_url_["addQueryArgs"])('post.php', {
  7197. 'get-post-lock': '1',
  7198. lockKey: true,
  7199. post: postId,
  7200. action: 'edit',
  7201. _wpnonce: postLockUtils.nonce
  7202. });
  7203. var allPostsUrl = getWPAdminURL('edit.php', {
  7204. post_type: Object(external_lodash_["get"])(postType, ['slug'])
  7205. });
  7206. var allPostsLabel = Object(external_this_wp_i18n_["__"])('Exit the Editor');
  7207. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Modal"], {
  7208. title: isTakeover ? Object(external_this_wp_i18n_["__"])('Someone else has taken over this post.') : Object(external_this_wp_i18n_["__"])('This post is already being edited.'),
  7209. focusOnMount: true,
  7210. shouldCloseOnClickOutside: false,
  7211. shouldCloseOnEsc: false,
  7212. isDismissable: false,
  7213. className: "editor-post-locked-modal"
  7214. }, !!userAvatar && Object(external_this_wp_element_["createElement"])("img", {
  7215. src: userAvatar,
  7216. alt: Object(external_this_wp_i18n_["__"])('Avatar'),
  7217. className: "editor-post-locked-modal__avatar"
  7218. }), !!isTakeover && Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_this_wp_i18n_["sprintf"])(
  7219. /* translators: %s: user's display name */
  7220. Object(external_this_wp_i18n_["__"])('%s now has editing control of this post. Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : Object(external_this_wp_i18n_["__"])('Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.')), Object(external_this_wp_element_["createElement"])("div", {
  7221. className: "editor-post-locked-modal__buttons"
  7222. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  7223. isPrimary: true,
  7224. isLarge: true,
  7225. href: allPostsUrl
  7226. }, allPostsLabel))), !isTakeover && Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_this_wp_i18n_["sprintf"])(
  7227. /* translators: %s: user's display name */
  7228. Object(external_this_wp_i18n_["__"])('%s is currently working on this post, which means you cannot make changes, unless you take over.'), userDisplayName) : Object(external_this_wp_i18n_["__"])('Another user is currently working on this post, which means you cannot make changes, unless you take over.')), Object(external_this_wp_element_["createElement"])("div", {
  7229. className: "editor-post-locked-modal__buttons"
  7230. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  7231. isDefault: true,
  7232. isLarge: true,
  7233. href: allPostsUrl
  7234. }, allPostsLabel), Object(external_this_wp_element_["createElement"])(post_preview_button, null), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  7235. isPrimary: true,
  7236. isLarge: true,
  7237. href: unlockUrl
  7238. }, Object(external_this_wp_i18n_["__"])('Take Over')))));
  7239. }
  7240. }]);
  7241. return PostLockedModal;
  7242. }(external_this_wp_element_["Component"]);
  7243. /* harmony default export */ var post_locked_modal = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) {
  7244. var _select = select('core/editor'),
  7245. isPostLocked = _select.isPostLocked,
  7246. isPostLockTakeover = _select.isPostLockTakeover,
  7247. getPostLockUser = _select.getPostLockUser,
  7248. getCurrentPostId = _select.getCurrentPostId,
  7249. getActivePostLock = _select.getActivePostLock,
  7250. getEditedPostAttribute = _select.getEditedPostAttribute,
  7251. getEditorSettings = _select.getEditorSettings;
  7252. var _select2 = select('core'),
  7253. getPostType = _select2.getPostType;
  7254. return {
  7255. isLocked: isPostLocked(),
  7256. isTakeover: isPostLockTakeover(),
  7257. user: getPostLockUser(),
  7258. postId: getCurrentPostId(),
  7259. postLockUtils: getEditorSettings().postLockUtils,
  7260. activePostLock: getActivePostLock(),
  7261. postType: getPostType(getEditedPostAttribute('type'))
  7262. };
  7263. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  7264. var _dispatch = dispatch('core/editor'),
  7265. autosave = _dispatch.autosave,
  7266. updatePostLock = _dispatch.updatePostLock;
  7267. return {
  7268. autosave: autosave,
  7269. updatePostLock: updatePostLock
  7270. };
  7271. }), external_this_wp_compose_["withInstanceId"], Object(external_this_wp_compose_["withGlobalEvents"])({
  7272. beforeunload: 'releasePostLock'
  7273. }))(post_locked_modal_PostLockedModal));
  7274. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js
  7275. /**
  7276. * External dependencies
  7277. */
  7278. /**
  7279. * WordPress dependencies
  7280. */
  7281. function PostPendingStatusCheck(_ref) {
  7282. var hasPublishAction = _ref.hasPublishAction,
  7283. isPublished = _ref.isPublished,
  7284. children = _ref.children;
  7285. if (isPublished || !hasPublishAction) {
  7286. return null;
  7287. }
  7288. return children;
  7289. }
  7290. /* harmony default export */ var post_pending_status_check = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) {
  7291. var _select = select('core/editor'),
  7292. isCurrentPostPublished = _select.isCurrentPostPublished,
  7293. getCurrentPostType = _select.getCurrentPostType,
  7294. getCurrentPost = _select.getCurrentPost;
  7295. return {
  7296. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  7297. isPublished: isCurrentPostPublished(),
  7298. postType: getCurrentPostType()
  7299. };
  7300. }))(PostPendingStatusCheck));
  7301. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js
  7302. /**
  7303. * WordPress dependencies
  7304. */
  7305. /**
  7306. * Internal dependencies
  7307. */
  7308. function PostPendingStatus(_ref) {
  7309. var status = _ref.status,
  7310. onUpdateStatus = _ref.onUpdateStatus;
  7311. var togglePendingStatus = function togglePendingStatus() {
  7312. var updatedStatus = status === 'pending' ? 'draft' : 'pending';
  7313. onUpdateStatus(updatedStatus);
  7314. };
  7315. return Object(external_this_wp_element_["createElement"])(post_pending_status_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], {
  7316. label: Object(external_this_wp_i18n_["__"])('Pending Review'),
  7317. checked: status === 'pending',
  7318. onChange: togglePendingStatus
  7319. }));
  7320. }
  7321. /* harmony default export */ var post_pending_status = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) {
  7322. return {
  7323. status: select('core/editor').getEditedPostAttribute('status')
  7324. };
  7325. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  7326. return {
  7327. onUpdateStatus: function onUpdateStatus(status) {
  7328. dispatch('core/editor').editPost({
  7329. status: status
  7330. });
  7331. }
  7332. };
  7333. }))(PostPendingStatus));
  7334. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js
  7335. /**
  7336. * WordPress dependencies
  7337. */
  7338. function PostPingbacks(_ref) {
  7339. var _ref$pingStatus = _ref.pingStatus,
  7340. pingStatus = _ref$pingStatus === void 0 ? 'open' : _ref$pingStatus,
  7341. props = Object(objectWithoutProperties["a" /* default */])(_ref, ["pingStatus"]);
  7342. var onTogglePingback = function onTogglePingback() {
  7343. return props.editPost({
  7344. ping_status: pingStatus === 'open' ? 'closed' : 'open'
  7345. });
  7346. };
  7347. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], {
  7348. label: Object(external_this_wp_i18n_["__"])('Allow Pingbacks & Trackbacks'),
  7349. checked: pingStatus === 'open',
  7350. onChange: onTogglePingback
  7351. });
  7352. }
  7353. /* harmony default export */ var post_pingbacks = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  7354. return {
  7355. pingStatus: select('core/editor').getEditedPostAttribute('ping_status')
  7356. };
  7357. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  7358. return {
  7359. editPost: dispatch('core/editor').editPost
  7360. };
  7361. })])(PostPingbacks));
  7362. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js
  7363. /**
  7364. * External dependencies
  7365. */
  7366. /**
  7367. * WordPress dependencies
  7368. */
  7369. function PublishButtonLabel(_ref) {
  7370. var isPublished = _ref.isPublished,
  7371. isBeingScheduled = _ref.isBeingScheduled,
  7372. isSaving = _ref.isSaving,
  7373. isPublishing = _ref.isPublishing,
  7374. hasPublishAction = _ref.hasPublishAction,
  7375. isAutosaving = _ref.isAutosaving;
  7376. if (isPublishing) {
  7377. return Object(external_this_wp_i18n_["__"])('Publishing…');
  7378. } else if (isPublished && isSaving && !isAutosaving) {
  7379. return Object(external_this_wp_i18n_["__"])('Updating…');
  7380. } else if (isBeingScheduled && isSaving && !isAutosaving) {
  7381. return Object(external_this_wp_i18n_["__"])('Scheduling…');
  7382. }
  7383. if (!hasPublishAction) {
  7384. return Object(external_this_wp_i18n_["__"])('Submit for Review');
  7385. } else if (isPublished) {
  7386. return Object(external_this_wp_i18n_["__"])('Update');
  7387. } else if (isBeingScheduled) {
  7388. return Object(external_this_wp_i18n_["__"])('Schedule');
  7389. }
  7390. return Object(external_this_wp_i18n_["__"])('Publish');
  7391. }
  7392. /* harmony default export */ var post_publish_button_label = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) {
  7393. var forceIsSaving = _ref2.forceIsSaving;
  7394. var _select = select('core/editor'),
  7395. isCurrentPostPublished = _select.isCurrentPostPublished,
  7396. isEditedPostBeingScheduled = _select.isEditedPostBeingScheduled,
  7397. isSavingPost = _select.isSavingPost,
  7398. isPublishingPost = _select.isPublishingPost,
  7399. getCurrentPost = _select.getCurrentPost,
  7400. getCurrentPostType = _select.getCurrentPostType,
  7401. isAutosavingPost = _select.isAutosavingPost;
  7402. return {
  7403. isPublished: isCurrentPostPublished(),
  7404. isBeingScheduled: isEditedPostBeingScheduled(),
  7405. isSaving: forceIsSaving || isSavingPost(),
  7406. isPublishing: isPublishingPost(),
  7407. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  7408. postType: getCurrentPostType(),
  7409. isAutosaving: isAutosavingPost()
  7410. };
  7411. })])(PublishButtonLabel));
  7412. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js
  7413. /**
  7414. * External dependencies
  7415. */
  7416. /**
  7417. * WordPress dependencies
  7418. */
  7419. /**
  7420. * Internal dependencies
  7421. */
  7422. var post_publish_button_PostPublishButton =
  7423. /*#__PURE__*/
  7424. function (_Component) {
  7425. Object(inherits["a" /* default */])(PostPublishButton, _Component);
  7426. function PostPublishButton(props) {
  7427. var _this;
  7428. Object(classCallCheck["a" /* default */])(this, PostPublishButton);
  7429. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPublishButton).call(this, props));
  7430. _this.buttonNode = Object(external_this_wp_element_["createRef"])();
  7431. return _this;
  7432. }
  7433. Object(createClass["a" /* default */])(PostPublishButton, [{
  7434. key: "componentDidMount",
  7435. value: function componentDidMount() {
  7436. if (this.props.focusOnMount) {
  7437. this.buttonNode.current.focus();
  7438. }
  7439. }
  7440. }, {
  7441. key: "render",
  7442. value: function render() {
  7443. var _this$props = this.props,
  7444. forceIsDirty = _this$props.forceIsDirty,
  7445. forceIsSaving = _this$props.forceIsSaving,
  7446. hasPublishAction = _this$props.hasPublishAction,
  7447. isBeingScheduled = _this$props.isBeingScheduled,
  7448. isOpen = _this$props.isOpen,
  7449. isPostSavingLocked = _this$props.isPostSavingLocked,
  7450. isPublishable = _this$props.isPublishable,
  7451. isPublished = _this$props.isPublished,
  7452. isSaveable = _this$props.isSaveable,
  7453. isSaving = _this$props.isSaving,
  7454. isToggle = _this$props.isToggle,
  7455. onSave = _this$props.onSave,
  7456. onStatusChange = _this$props.onStatusChange,
  7457. _this$props$onSubmit = _this$props.onSubmit,
  7458. onSubmit = _this$props$onSubmit === void 0 ? external_lodash_["noop"] : _this$props$onSubmit,
  7459. onToggle = _this$props.onToggle,
  7460. visibility = _this$props.visibility;
  7461. var isButtonDisabled = isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty;
  7462. var isToggleDisabled = isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty;
  7463. var publishStatus;
  7464. if (!hasPublishAction) {
  7465. publishStatus = 'pending';
  7466. } else if (isBeingScheduled) {
  7467. publishStatus = 'future';
  7468. } else if (visibility === 'private') {
  7469. publishStatus = 'private';
  7470. } else {
  7471. publishStatus = 'publish';
  7472. }
  7473. var onClickButton = function onClickButton() {
  7474. if (isButtonDisabled) {
  7475. return;
  7476. }
  7477. onSubmit();
  7478. onStatusChange(publishStatus);
  7479. onSave();
  7480. };
  7481. var onClickToggle = function onClickToggle() {
  7482. if (isToggleDisabled) {
  7483. return;
  7484. }
  7485. onToggle();
  7486. };
  7487. var buttonProps = {
  7488. 'aria-disabled': isButtonDisabled,
  7489. className: 'editor-post-publish-button',
  7490. isBusy: isSaving && isPublished,
  7491. isPrimary: true,
  7492. onClick: onClickButton
  7493. };
  7494. var toggleProps = {
  7495. 'aria-disabled': isToggleDisabled,
  7496. 'aria-expanded': isOpen,
  7497. className: 'editor-post-publish-panel__toggle',
  7498. isBusy: isSaving && isPublished,
  7499. isPrimary: true,
  7500. onClick: onClickToggle
  7501. };
  7502. var toggleChildren = isBeingScheduled ? Object(external_this_wp_i18n_["__"])('Schedule…') : Object(external_this_wp_i18n_["__"])('Publish…');
  7503. var buttonChildren = Object(external_this_wp_element_["createElement"])(post_publish_button_label, {
  7504. forceIsSaving: forceIsSaving
  7505. });
  7506. var componentProps = isToggle ? toggleProps : buttonProps;
  7507. var componentChildren = isToggle ? toggleChildren : buttonChildren;
  7508. return Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({
  7509. ref: this.buttonNode
  7510. }, componentProps), componentChildren), Object(external_this_wp_element_["createElement"])(external_this_wp_nux_["DotTip"], {
  7511. tipId: "core/editor.publish"
  7512. }, Object(external_this_wp_i18n_["__"])('Finished writing? That’s great, let’s get this published right now. Just click “Publish” and you’re good to go.')));
  7513. }
  7514. }]);
  7515. return PostPublishButton;
  7516. }(external_this_wp_element_["Component"]);
  7517. /* harmony default export */ var post_publish_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  7518. var _select = select('core/editor'),
  7519. isSavingPost = _select.isSavingPost,
  7520. isEditedPostBeingScheduled = _select.isEditedPostBeingScheduled,
  7521. getEditedPostVisibility = _select.getEditedPostVisibility,
  7522. isCurrentPostPublished = _select.isCurrentPostPublished,
  7523. isEditedPostSaveable = _select.isEditedPostSaveable,
  7524. isEditedPostPublishable = _select.isEditedPostPublishable,
  7525. isPostSavingLocked = _select.isPostSavingLocked,
  7526. getCurrentPost = _select.getCurrentPost,
  7527. getCurrentPostType = _select.getCurrentPostType;
  7528. return {
  7529. isSaving: isSavingPost(),
  7530. isBeingScheduled: isEditedPostBeingScheduled(),
  7531. visibility: getEditedPostVisibility(),
  7532. isSaveable: isEditedPostSaveable(),
  7533. isPostSavingLocked: isPostSavingLocked(),
  7534. isPublishable: isEditedPostPublishable(),
  7535. isPublished: isCurrentPostPublished(),
  7536. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  7537. postType: getCurrentPostType()
  7538. };
  7539. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  7540. var _dispatch = dispatch('core/editor'),
  7541. editPost = _dispatch.editPost,
  7542. savePost = _dispatch.savePost;
  7543. return {
  7544. onStatusChange: function onStatusChange(status) {
  7545. return editPost({
  7546. status: status
  7547. }, {
  7548. undoIgnore: true
  7549. });
  7550. },
  7551. onSave: savePost
  7552. };
  7553. })])(post_publish_button_PostPublishButton));
  7554. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js
  7555. /**
  7556. * WordPress dependencies
  7557. */
  7558. var visibilityOptions = [{
  7559. value: 'public',
  7560. label: Object(external_this_wp_i18n_["__"])('Public'),
  7561. info: Object(external_this_wp_i18n_["__"])('Visible to everyone.')
  7562. }, {
  7563. value: 'private',
  7564. label: Object(external_this_wp_i18n_["__"])('Private'),
  7565. info: Object(external_this_wp_i18n_["__"])('Only visible to site admins and editors.')
  7566. }, {
  7567. value: 'password',
  7568. label: Object(external_this_wp_i18n_["__"])('Password Protected'),
  7569. info: Object(external_this_wp_i18n_["__"])('Protected with a password you choose. Only those with the password can view this post.')
  7570. }];
  7571. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js
  7572. /**
  7573. * WordPress dependencies
  7574. */
  7575. /**
  7576. * Internal dependencies
  7577. */
  7578. var post_visibility_PostVisibility =
  7579. /*#__PURE__*/
  7580. function (_Component) {
  7581. Object(inherits["a" /* default */])(PostVisibility, _Component);
  7582. function PostVisibility(props) {
  7583. var _this;
  7584. Object(classCallCheck["a" /* default */])(this, PostVisibility);
  7585. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostVisibility).apply(this, arguments));
  7586. _this.setPublic = _this.setPublic.bind(Object(assertThisInitialized["a" /* default */])(_this));
  7587. _this.setPrivate = _this.setPrivate.bind(Object(assertThisInitialized["a" /* default */])(_this));
  7588. _this.setPasswordProtected = _this.setPasswordProtected.bind(Object(assertThisInitialized["a" /* default */])(_this));
  7589. _this.updatePassword = _this.updatePassword.bind(Object(assertThisInitialized["a" /* default */])(_this));
  7590. _this.state = {
  7591. hasPassword: !!props.password
  7592. };
  7593. return _this;
  7594. }
  7595. Object(createClass["a" /* default */])(PostVisibility, [{
  7596. key: "setPublic",
  7597. value: function setPublic() {
  7598. var _this$props = this.props,
  7599. visibility = _this$props.visibility,
  7600. onUpdateVisibility = _this$props.onUpdateVisibility,
  7601. status = _this$props.status;
  7602. onUpdateVisibility(visibility === 'private' ? 'draft' : status);
  7603. this.setState({
  7604. hasPassword: false
  7605. });
  7606. }
  7607. }, {
  7608. key: "setPrivate",
  7609. value: function setPrivate() {
  7610. if (!window.confirm(Object(external_this_wp_i18n_["__"])('Would you like to privately publish this post now?'))) {
  7611. // eslint-disable-line no-alert
  7612. return;
  7613. }
  7614. var _this$props2 = this.props,
  7615. onUpdateVisibility = _this$props2.onUpdateVisibility,
  7616. onSave = _this$props2.onSave;
  7617. onUpdateVisibility('private');
  7618. this.setState({
  7619. hasPassword: false
  7620. });
  7621. onSave();
  7622. }
  7623. }, {
  7624. key: "setPasswordProtected",
  7625. value: function setPasswordProtected() {
  7626. var _this$props3 = this.props,
  7627. visibility = _this$props3.visibility,
  7628. onUpdateVisibility = _this$props3.onUpdateVisibility,
  7629. status = _this$props3.status,
  7630. password = _this$props3.password;
  7631. onUpdateVisibility(visibility === 'private' ? 'draft' : status, password || '');
  7632. this.setState({
  7633. hasPassword: true
  7634. });
  7635. }
  7636. }, {
  7637. key: "updatePassword",
  7638. value: function updatePassword(event) {
  7639. var _this$props4 = this.props,
  7640. status = _this$props4.status,
  7641. onUpdateVisibility = _this$props4.onUpdateVisibility;
  7642. onUpdateVisibility(status, event.target.value);
  7643. }
  7644. }, {
  7645. key: "render",
  7646. value: function render() {
  7647. var _this$props5 = this.props,
  7648. visibility = _this$props5.visibility,
  7649. password = _this$props5.password,
  7650. instanceId = _this$props5.instanceId;
  7651. var visibilityHandlers = {
  7652. public: {
  7653. onSelect: this.setPublic,
  7654. checked: visibility === 'public' && !this.state.hasPassword
  7655. },
  7656. private: {
  7657. onSelect: this.setPrivate,
  7658. checked: visibility === 'private'
  7659. },
  7660. password: {
  7661. onSelect: this.setPasswordProtected,
  7662. checked: this.state.hasPassword
  7663. }
  7664. };
  7665. return [Object(external_this_wp_element_["createElement"])("fieldset", {
  7666. key: "visibility-selector",
  7667. className: "editor-post-visibility__dialog-fieldset"
  7668. }, Object(external_this_wp_element_["createElement"])("legend", {
  7669. className: "editor-post-visibility__dialog-legend"
  7670. }, Object(external_this_wp_i18n_["__"])('Post Visibility')), visibilityOptions.map(function (_ref) {
  7671. var value = _ref.value,
  7672. label = _ref.label,
  7673. info = _ref.info;
  7674. return Object(external_this_wp_element_["createElement"])("div", {
  7675. key: value,
  7676. className: "editor-post-visibility__choice"
  7677. }, Object(external_this_wp_element_["createElement"])("input", {
  7678. type: "radio",
  7679. name: "editor-post-visibility__setting-".concat(instanceId),
  7680. value: value,
  7681. onChange: visibilityHandlers[value].onSelect,
  7682. checked: visibilityHandlers[value].checked,
  7683. id: "editor-post-".concat(value, "-").concat(instanceId),
  7684. "aria-describedby": "editor-post-".concat(value, "-").concat(instanceId, "-description"),
  7685. className: "editor-post-visibility__dialog-radio"
  7686. }), Object(external_this_wp_element_["createElement"])("label", {
  7687. htmlFor: "editor-post-".concat(value, "-").concat(instanceId),
  7688. className: "editor-post-visibility__dialog-label"
  7689. }, label), Object(external_this_wp_element_["createElement"])("p", {
  7690. id: "editor-post-".concat(value, "-").concat(instanceId, "-description"),
  7691. className: "editor-post-visibility__dialog-info"
  7692. }, info));
  7693. })), this.state.hasPassword && Object(external_this_wp_element_["createElement"])("div", {
  7694. className: "editor-post-visibility__dialog-password",
  7695. key: "password-selector"
  7696. }, Object(external_this_wp_element_["createElement"])("label", {
  7697. htmlFor: "editor-post-visibility__dialog-password-input-".concat(instanceId),
  7698. className: "screen-reader-text"
  7699. }, Object(external_this_wp_i18n_["__"])('Create password')), Object(external_this_wp_element_["createElement"])("input", {
  7700. className: "editor-post-visibility__dialog-password-input",
  7701. id: "editor-post-visibility__dialog-password-input-".concat(instanceId),
  7702. type: "text",
  7703. onChange: this.updatePassword,
  7704. value: password,
  7705. placeholder: Object(external_this_wp_i18n_["__"])('Use a secure password')
  7706. }))];
  7707. }
  7708. }]);
  7709. return PostVisibility;
  7710. }(external_this_wp_element_["Component"]);
  7711. /* harmony default export */ var post_visibility = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  7712. var _select = select('core/editor'),
  7713. getEditedPostAttribute = _select.getEditedPostAttribute,
  7714. getEditedPostVisibility = _select.getEditedPostVisibility;
  7715. return {
  7716. status: getEditedPostAttribute('status'),
  7717. visibility: getEditedPostVisibility(),
  7718. password: getEditedPostAttribute('password')
  7719. };
  7720. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  7721. var _dispatch = dispatch('core/editor'),
  7722. savePost = _dispatch.savePost,
  7723. editPost = _dispatch.editPost;
  7724. return {
  7725. onSave: savePost,
  7726. onUpdateVisibility: function onUpdateVisibility(status) {
  7727. var password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  7728. editPost({
  7729. status: status,
  7730. password: password
  7731. });
  7732. }
  7733. };
  7734. }), external_this_wp_compose_["withInstanceId"]])(post_visibility_PostVisibility));
  7735. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js
  7736. /**
  7737. * External dependencies
  7738. */
  7739. /**
  7740. * WordPress dependencies
  7741. */
  7742. /**
  7743. * Internal dependencies
  7744. */
  7745. function PostVisibilityLabel(_ref) {
  7746. var visibility = _ref.visibility;
  7747. var getVisibilityLabel = function getVisibilityLabel() {
  7748. return Object(external_lodash_["find"])(visibilityOptions, {
  7749. value: visibility
  7750. }).label;
  7751. };
  7752. return getVisibilityLabel(visibility);
  7753. }
  7754. /* harmony default export */ var post_visibility_label = (Object(external_this_wp_data_["withSelect"])(function (select) {
  7755. return {
  7756. visibility: select('core/editor').getEditedPostVisibility()
  7757. };
  7758. })(PostVisibilityLabel));
  7759. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js
  7760. /**
  7761. * WordPress dependencies
  7762. */
  7763. function PostSchedule(_ref) {
  7764. var date = _ref.date,
  7765. onUpdateDate = _ref.onUpdateDate;
  7766. var settings = Object(external_this_wp_date_["__experimentalGetSettings"])(); // To know if the current timezone is a 12 hour time with look for "a" in the time format
  7767. // We also make sure this a is not escaped by a "/"
  7768. var is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a
  7769. .replace(/\\\\/g, '') // Replace "//" with empty strings
  7770. .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash
  7771. );
  7772. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DateTimePicker"], {
  7773. key: "date-time-picker",
  7774. currentDate: date,
  7775. onChange: onUpdateDate,
  7776. is12Hour: is12HourTime
  7777. });
  7778. }
  7779. /* harmony default export */ var post_schedule = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  7780. return {
  7781. date: select('core/editor').getEditedPostAttribute('date')
  7782. };
  7783. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  7784. return {
  7785. onUpdateDate: function onUpdateDate(date) {
  7786. dispatch('core/editor').editPost({
  7787. date: date
  7788. });
  7789. }
  7790. };
  7791. })])(PostSchedule));
  7792. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js
  7793. /**
  7794. * WordPress dependencies
  7795. */
  7796. function PostScheduleLabel(_ref) {
  7797. var date = _ref.date,
  7798. isFloating = _ref.isFloating;
  7799. var settings = Object(external_this_wp_date_["__experimentalGetSettings"])();
  7800. return date && !isFloating ? Object(external_this_wp_date_["dateI18n"])("".concat(settings.formats.date, " ").concat(settings.formats.time), date) : Object(external_this_wp_i18n_["__"])('Immediately');
  7801. }
  7802. /* harmony default export */ var post_schedule_label = (Object(external_this_wp_data_["withSelect"])(function (select) {
  7803. return {
  7804. date: select('core/editor').getEditedPostAttribute('date'),
  7805. isFloating: select('core/editor').isEditedPostDateFloating()
  7806. };
  7807. })(PostScheduleLabel));
  7808. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js
  7809. /**
  7810. * External dependencies
  7811. */
  7812. /**
  7813. * WordPress dependencies
  7814. */
  7815. /**
  7816. * Module constants
  7817. */
  7818. var DEFAULT_QUERY = {
  7819. per_page: -1,
  7820. orderby: 'count',
  7821. order: 'desc',
  7822. _fields: 'id,name'
  7823. };
  7824. var MAX_TERMS_SUGGESTIONS = 20;
  7825. var isSameTermName = function isSameTermName(termA, termB) {
  7826. return termA.toLowerCase() === termB.toLowerCase();
  7827. };
  7828. /**
  7829. * Returns a term object with name unescaped.
  7830. * The unescape of the name property is done using lodash unescape function.
  7831. *
  7832. * @param {Object} term The term object to unescape.
  7833. *
  7834. * @return {Object} Term object with name property unescaped.
  7835. */
  7836. var flat_term_selector_unescapeTerm = function unescapeTerm(term) {
  7837. return Object(objectSpread["a" /* default */])({}, term, {
  7838. name: Object(external_lodash_["unescape"])(term.name)
  7839. });
  7840. };
  7841. /**
  7842. * Returns an array of term objects with names unescaped.
  7843. * The unescape of each term is performed using the unescapeTerm function.
  7844. *
  7845. * @param {Object[]} terms Array of term objects to unescape.
  7846. *
  7847. * @return {Object[]} Array of term objects unescaped.
  7848. */
  7849. var flat_term_selector_unescapeTerms = function unescapeTerms(terms) {
  7850. return Object(external_lodash_["map"])(terms, flat_term_selector_unescapeTerm);
  7851. };
  7852. var flat_term_selector_FlatTermSelector =
  7853. /*#__PURE__*/
  7854. function (_Component) {
  7855. Object(inherits["a" /* default */])(FlatTermSelector, _Component);
  7856. function FlatTermSelector() {
  7857. var _this;
  7858. Object(classCallCheck["a" /* default */])(this, FlatTermSelector);
  7859. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(FlatTermSelector).apply(this, arguments));
  7860. _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this));
  7861. _this.searchTerms = Object(external_lodash_["throttle"])(_this.searchTerms.bind(Object(assertThisInitialized["a" /* default */])(_this)), 500);
  7862. _this.findOrCreateTerm = _this.findOrCreateTerm.bind(Object(assertThisInitialized["a" /* default */])(_this));
  7863. _this.state = {
  7864. loading: !Object(external_lodash_["isEmpty"])(_this.props.terms),
  7865. availableTerms: [],
  7866. selectedTerms: []
  7867. };
  7868. return _this;
  7869. }
  7870. Object(createClass["a" /* default */])(FlatTermSelector, [{
  7871. key: "componentDidMount",
  7872. value: function componentDidMount() {
  7873. var _this2 = this;
  7874. if (!Object(external_lodash_["isEmpty"])(this.props.terms)) {
  7875. this.initRequest = this.fetchTerms({
  7876. include: this.props.terms.join(','),
  7877. per_page: -1
  7878. });
  7879. this.initRequest.then(function () {
  7880. _this2.setState({
  7881. loading: false
  7882. });
  7883. }, function (xhr) {
  7884. if (xhr.statusText === 'abort') {
  7885. return;
  7886. }
  7887. _this2.setState({
  7888. loading: false
  7889. });
  7890. });
  7891. }
  7892. }
  7893. }, {
  7894. key: "componentWillUnmount",
  7895. value: function componentWillUnmount() {
  7896. Object(external_lodash_["invoke"])(this.initRequest, ['abort']);
  7897. Object(external_lodash_["invoke"])(this.searchRequest, ['abort']);
  7898. }
  7899. }, {
  7900. key: "componentDidUpdate",
  7901. value: function componentDidUpdate(prevProps) {
  7902. if (prevProps.terms !== this.props.terms) {
  7903. this.updateSelectedTerms(this.props.terms);
  7904. }
  7905. }
  7906. }, {
  7907. key: "fetchTerms",
  7908. value: function fetchTerms() {
  7909. var _this3 = this;
  7910. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7911. var taxonomy = this.props.taxonomy;
  7912. var query = Object(objectSpread["a" /* default */])({}, DEFAULT_QUERY, params);
  7913. var request = external_this_wp_apiFetch_default()({
  7914. path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), query)
  7915. });
  7916. request.then(flat_term_selector_unescapeTerms).then(function (terms) {
  7917. _this3.setState(function (state) {
  7918. return {
  7919. availableTerms: state.availableTerms.concat(terms.filter(function (term) {
  7920. return !Object(external_lodash_["find"])(state.availableTerms, function (availableTerm) {
  7921. return availableTerm.id === term.id;
  7922. });
  7923. }))
  7924. };
  7925. });
  7926. _this3.updateSelectedTerms(_this3.props.terms);
  7927. });
  7928. return request;
  7929. }
  7930. }, {
  7931. key: "updateSelectedTerms",
  7932. value: function updateSelectedTerms() {
  7933. var _this4 = this;
  7934. var terms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  7935. var selectedTerms = terms.reduce(function (result, termId) {
  7936. var termObject = Object(external_lodash_["find"])(_this4.state.availableTerms, function (term) {
  7937. return term.id === termId;
  7938. });
  7939. if (termObject) {
  7940. result.push(termObject.name);
  7941. }
  7942. return result;
  7943. }, []);
  7944. this.setState({
  7945. selectedTerms: selectedTerms
  7946. });
  7947. }
  7948. }, {
  7949. key: "findOrCreateTerm",
  7950. value: function findOrCreateTerm(termName) {
  7951. var _this5 = this;
  7952. var taxonomy = this.props.taxonomy;
  7953. var termNameEscaped = Object(external_lodash_["escape"])(termName); // Tries to create a term or fetch it if it already exists.
  7954. return external_this_wp_apiFetch_default()({
  7955. path: "/wp/v2/".concat(taxonomy.rest_base),
  7956. method: 'POST',
  7957. data: {
  7958. name: termNameEscaped
  7959. }
  7960. }).catch(function (error) {
  7961. var errorCode = error.code;
  7962. if (errorCode === 'term_exists') {
  7963. // If the terms exist, fetch it instead of creating a new one.
  7964. _this5.addRequest = external_this_wp_apiFetch_default()({
  7965. path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), Object(objectSpread["a" /* default */])({}, DEFAULT_QUERY, {
  7966. search: termNameEscaped
  7967. }))
  7968. }).then(flat_term_selector_unescapeTerms);
  7969. return _this5.addRequest.then(function (searchResult) {
  7970. return Object(external_lodash_["find"])(searchResult, function (result) {
  7971. return isSameTermName(result.name, termName);
  7972. });
  7973. });
  7974. }
  7975. return Promise.reject(error);
  7976. }).then(flat_term_selector_unescapeTerm);
  7977. }
  7978. }, {
  7979. key: "onChange",
  7980. value: function onChange(termNames) {
  7981. var _this6 = this;
  7982. var uniqueTerms = Object(external_lodash_["uniqBy"])(termNames, function (term) {
  7983. return term.toLowerCase();
  7984. });
  7985. this.setState({
  7986. selectedTerms: uniqueTerms
  7987. });
  7988. var newTermNames = uniqueTerms.filter(function (termName) {
  7989. return !Object(external_lodash_["find"])(_this6.state.availableTerms, function (term) {
  7990. return isSameTermName(term.name, termName);
  7991. });
  7992. });
  7993. var termNamesToIds = function termNamesToIds(names, availableTerms) {
  7994. return names.map(function (termName) {
  7995. return Object(external_lodash_["find"])(availableTerms, function (term) {
  7996. return isSameTermName(term.name, termName);
  7997. }).id;
  7998. });
  7999. };
  8000. if (newTermNames.length === 0) {
  8001. return this.props.onUpdateTerms(termNamesToIds(uniqueTerms, this.state.availableTerms), this.props.taxonomy.rest_base);
  8002. }
  8003. Promise.all(newTermNames.map(this.findOrCreateTerm)).then(function (newTerms) {
  8004. var newAvailableTerms = _this6.state.availableTerms.concat(newTerms);
  8005. _this6.setState({
  8006. availableTerms: newAvailableTerms
  8007. });
  8008. return _this6.props.onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms), _this6.props.taxonomy.rest_base);
  8009. });
  8010. }
  8011. }, {
  8012. key: "searchTerms",
  8013. value: function searchTerms() {
  8014. var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  8015. Object(external_lodash_["invoke"])(this.searchRequest, ['abort']);
  8016. this.searchRequest = this.fetchTerms({
  8017. search: search
  8018. });
  8019. }
  8020. }, {
  8021. key: "render",
  8022. value: function render() {
  8023. var _this$props = this.props,
  8024. slug = _this$props.slug,
  8025. taxonomy = _this$props.taxonomy,
  8026. hasAssignAction = _this$props.hasAssignAction;
  8027. if (!hasAssignAction) {
  8028. return null;
  8029. }
  8030. var _this$state = this.state,
  8031. loading = _this$state.loading,
  8032. availableTerms = _this$state.availableTerms,
  8033. selectedTerms = _this$state.selectedTerms;
  8034. var termNames = availableTerms.map(function (term) {
  8035. return term.name;
  8036. });
  8037. var newTermLabel = Object(external_lodash_["get"])(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? Object(external_this_wp_i18n_["__"])('Add New Tag') : Object(external_this_wp_i18n_["__"])('Add New Term'));
  8038. var singularName = Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_this_wp_i18n_["__"])('Tag') : Object(external_this_wp_i18n_["__"])('Term'));
  8039. var termAddedLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('%s added', 'term'), singularName);
  8040. var termRemovedLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('%s removed', 'term'), singularName);
  8041. var removeTermLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('Remove %s', 'term'), singularName);
  8042. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["FormTokenField"], {
  8043. value: selectedTerms,
  8044. suggestions: termNames,
  8045. onChange: this.onChange,
  8046. onInputChange: this.searchTerms,
  8047. maxSuggestions: MAX_TERMS_SUGGESTIONS,
  8048. disabled: loading,
  8049. label: newTermLabel,
  8050. messages: {
  8051. added: termAddedLabel,
  8052. removed: termRemovedLabel,
  8053. remove: removeTermLabel
  8054. }
  8055. });
  8056. }
  8057. }]);
  8058. return FlatTermSelector;
  8059. }(external_this_wp_element_["Component"]);
  8060. /* harmony default export */ var flat_term_selector = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select, _ref) {
  8061. var slug = _ref.slug;
  8062. var _select = select('core/editor'),
  8063. getCurrentPost = _select.getCurrentPost;
  8064. var _select2 = select('core'),
  8065. getTaxonomy = _select2.getTaxonomy;
  8066. var taxonomy = getTaxonomy(slug);
  8067. return {
  8068. hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false,
  8069. hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false,
  8070. terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [],
  8071. taxonomy: taxonomy
  8072. };
  8073. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  8074. return {
  8075. onUpdateTerms: function onUpdateTerms(terms, restBase) {
  8076. dispatch('core/editor').editPost(Object(defineProperty["a" /* default */])({}, restBase, terms));
  8077. }
  8078. };
  8079. }), Object(external_this_wp_components_["withFilters"])('editor.PostTaxonomyType'))(flat_term_selector_FlatTermSelector));
  8080. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js
  8081. /**
  8082. * External dependencies
  8083. */
  8084. /**
  8085. * WordPress dependencies
  8086. */
  8087. /**
  8088. * Internal dependencies
  8089. */
  8090. var maybe_tags_panel_TagsPanel = function TagsPanel() {
  8091. var panelBodyTitle = [Object(external_this_wp_i18n_["__"])('Suggestion:'), Object(external_this_wp_element_["createElement"])("span", {
  8092. className: "editor-post-publish-panel__link",
  8093. key: "label"
  8094. }, Object(external_this_wp_i18n_["__"])('Add tags'))];
  8095. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], {
  8096. initialOpen: false,
  8097. title: panelBodyTitle
  8098. }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), Object(external_this_wp_element_["createElement"])(flat_term_selector, {
  8099. slug: 'post_tag'
  8100. }));
  8101. };
  8102. var maybe_tags_panel_MaybeTagsPanel =
  8103. /*#__PURE__*/
  8104. function (_Component) {
  8105. Object(inherits["a" /* default */])(MaybeTagsPanel, _Component);
  8106. function MaybeTagsPanel(props) {
  8107. var _this;
  8108. Object(classCallCheck["a" /* default */])(this, MaybeTagsPanel);
  8109. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(MaybeTagsPanel).call(this, props));
  8110. _this.state = {
  8111. hadTagsWhenOpeningThePanel: props.hasTags
  8112. };
  8113. return _this;
  8114. }
  8115. /*
  8116. * We only want to show the tag panel if the post didn't have
  8117. * any tags when the user hit the Publish button.
  8118. *
  8119. * We can't use the prop.hasTags because it'll change to true
  8120. * if the user adds a new tag within the pre-publish panel.
  8121. * This would force a re-render and a new prop.hasTags check,
  8122. * hiding this panel and keeping the user from adding
  8123. * more than one tag.
  8124. */
  8125. Object(createClass["a" /* default */])(MaybeTagsPanel, [{
  8126. key: "render",
  8127. value: function render() {
  8128. if (!this.state.hadTagsWhenOpeningThePanel) {
  8129. return Object(external_this_wp_element_["createElement"])(maybe_tags_panel_TagsPanel, null);
  8130. }
  8131. return null;
  8132. }
  8133. }]);
  8134. return MaybeTagsPanel;
  8135. }(external_this_wp_element_["Component"]);
  8136. /* harmony default export */ var maybe_tags_panel = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) {
  8137. var postType = select('core/editor').getCurrentPostType();
  8138. var tagsTaxonomy = select('core').getTaxonomy('post_tag');
  8139. var tags = tagsTaxonomy && select('core/editor').getEditedPostAttribute(tagsTaxonomy.rest_base);
  8140. return {
  8141. areTagsFetched: tagsTaxonomy !== undefined,
  8142. isPostTypeSupported: tagsTaxonomy && Object(external_lodash_["some"])(tagsTaxonomy.types, function (type) {
  8143. return type === postType;
  8144. }),
  8145. hasTags: tags && tags.length
  8146. };
  8147. }), Object(external_this_wp_compose_["ifCondition"])(function (_ref) {
  8148. var areTagsFetched = _ref.areTagsFetched,
  8149. isPostTypeSupported = _ref.isPostTypeSupported;
  8150. return isPostTypeSupported && areTagsFetched;
  8151. }))(maybe_tags_panel_MaybeTagsPanel));
  8152. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js
  8153. /**
  8154. * External dependencies
  8155. */
  8156. /**
  8157. * WordPress dependencies
  8158. */
  8159. /**
  8160. * Internal dependencies
  8161. */
  8162. var maybe_post_format_panel_PostFormatSuggestion = function PostFormatSuggestion(_ref) {
  8163. var suggestedPostFormat = _ref.suggestedPostFormat,
  8164. suggestionText = _ref.suggestionText,
  8165. onUpdatePostFormat = _ref.onUpdatePostFormat;
  8166. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  8167. isLink: true,
  8168. onClick: function onClick() {
  8169. return onUpdatePostFormat(suggestedPostFormat);
  8170. }
  8171. }, suggestionText);
  8172. };
  8173. var maybe_post_format_panel_PostFormatPanel = function PostFormatPanel(_ref2) {
  8174. var suggestion = _ref2.suggestion,
  8175. onUpdatePostFormat = _ref2.onUpdatePostFormat;
  8176. var panelBodyTitle = [Object(external_this_wp_i18n_["__"])('Suggestion:'), Object(external_this_wp_element_["createElement"])("span", {
  8177. className: "editor-post-publish-panel__link",
  8178. key: "label"
  8179. }, Object(external_this_wp_i18n_["__"])('Use a post format'))];
  8180. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], {
  8181. initialOpen: false,
  8182. title: panelBodyTitle
  8183. }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_element_["createElement"])(maybe_post_format_panel_PostFormatSuggestion, {
  8184. onUpdatePostFormat: onUpdatePostFormat,
  8185. suggestedPostFormat: suggestion.id,
  8186. suggestionText: Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Apply the "%1$s" format.'), suggestion.caption)
  8187. })));
  8188. };
  8189. var maybe_post_format_panel_getSuggestion = function getSuggestion(supportedFormats, suggestedPostFormat) {
  8190. var formats = POST_FORMATS.filter(function (format) {
  8191. return Object(external_lodash_["includes"])(supportedFormats, format.id);
  8192. });
  8193. return Object(external_lodash_["find"])(formats, function (format) {
  8194. return format.id === suggestedPostFormat;
  8195. });
  8196. };
  8197. /* harmony default export */ var maybe_post_format_panel = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) {
  8198. var _select = select('core/editor'),
  8199. getEditedPostAttribute = _select.getEditedPostAttribute,
  8200. getSuggestedPostFormat = _select.getSuggestedPostFormat;
  8201. var supportedFormats = Object(external_lodash_["get"])(select('core').getThemeSupports(), ['formats'], []);
  8202. return {
  8203. currentPostFormat: getEditedPostAttribute('format'),
  8204. suggestion: maybe_post_format_panel_getSuggestion(supportedFormats, getSuggestedPostFormat())
  8205. };
  8206. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  8207. return {
  8208. onUpdatePostFormat: function onUpdatePostFormat(postFormat) {
  8209. dispatch('core/editor').editPost({
  8210. format: postFormat
  8211. });
  8212. }
  8213. };
  8214. }), Object(external_this_wp_compose_["ifCondition"])(function (_ref3) {
  8215. var suggestion = _ref3.suggestion,
  8216. currentPostFormat = _ref3.currentPostFormat;
  8217. return suggestion && suggestion.id !== currentPostFormat;
  8218. }))(maybe_post_format_panel_PostFormatPanel));
  8219. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js
  8220. /**
  8221. * External dependencies
  8222. */
  8223. /**
  8224. * WordPress dependencies
  8225. */
  8226. /**
  8227. * Internal dependencies
  8228. */
  8229. function PostPublishPanelPrepublish(_ref) {
  8230. var hasPublishAction = _ref.hasPublishAction,
  8231. isBeingScheduled = _ref.isBeingScheduled,
  8232. children = _ref.children;
  8233. var prePublishTitle, prePublishBodyText;
  8234. if (!hasPublishAction) {
  8235. prePublishTitle = Object(external_this_wp_i18n_["__"])('Are you ready to submit for review?');
  8236. prePublishBodyText = Object(external_this_wp_i18n_["__"])('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.');
  8237. } else if (isBeingScheduled) {
  8238. prePublishTitle = Object(external_this_wp_i18n_["__"])('Are you ready to schedule?');
  8239. prePublishBodyText = Object(external_this_wp_i18n_["__"])('Your work will be published at the specified date and time.');
  8240. } else {
  8241. prePublishTitle = Object(external_this_wp_i18n_["__"])('Are you ready to publish?');
  8242. prePublishBodyText = Object(external_this_wp_i18n_["__"])('Double-check your settings before publishing.');
  8243. }
  8244. return Object(external_this_wp_element_["createElement"])("div", {
  8245. className: "editor-post-publish-panel__prepublish"
  8246. }, Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])("strong", null, prePublishTitle)), Object(external_this_wp_element_["createElement"])("p", null, prePublishBodyText), hasPublishAction && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], {
  8247. initialOpen: false,
  8248. title: [Object(external_this_wp_i18n_["__"])('Visibility:'), Object(external_this_wp_element_["createElement"])("span", {
  8249. className: "editor-post-publish-panel__link",
  8250. key: "label"
  8251. }, Object(external_this_wp_element_["createElement"])(post_visibility_label, null))]
  8252. }, Object(external_this_wp_element_["createElement"])(post_visibility, null)), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], {
  8253. initialOpen: false,
  8254. title: [Object(external_this_wp_i18n_["__"])('Publish:'), Object(external_this_wp_element_["createElement"])("span", {
  8255. className: "editor-post-publish-panel__link",
  8256. key: "label"
  8257. }, Object(external_this_wp_element_["createElement"])(post_schedule_label, null))]
  8258. }, Object(external_this_wp_element_["createElement"])(post_schedule, null))), Object(external_this_wp_element_["createElement"])(maybe_post_format_panel, null), Object(external_this_wp_element_["createElement"])(maybe_tags_panel, null), children);
  8259. }
  8260. /* harmony default export */ var prepublish = (Object(external_this_wp_data_["withSelect"])(function (select) {
  8261. var _select = select('core/editor'),
  8262. getCurrentPost = _select.getCurrentPost,
  8263. isEditedPostBeingScheduled = _select.isEditedPostBeingScheduled;
  8264. return {
  8265. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  8266. isBeingScheduled: isEditedPostBeingScheduled()
  8267. };
  8268. })(PostPublishPanelPrepublish));
  8269. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js
  8270. /**
  8271. * External dependencies
  8272. */
  8273. /**
  8274. * WordPress dependencies
  8275. */
  8276. /**
  8277. * Internal dependencies
  8278. */
  8279. var postpublish_PostPublishPanelPostpublish =
  8280. /*#__PURE__*/
  8281. function (_Component) {
  8282. Object(inherits["a" /* default */])(PostPublishPanelPostpublish, _Component);
  8283. function PostPublishPanelPostpublish() {
  8284. var _this;
  8285. Object(classCallCheck["a" /* default */])(this, PostPublishPanelPostpublish);
  8286. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPublishPanelPostpublish).apply(this, arguments));
  8287. _this.state = {
  8288. showCopyConfirmation: false
  8289. };
  8290. _this.onCopy = _this.onCopy.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8291. _this.onSelectInput = _this.onSelectInput.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8292. _this.postLink = Object(external_this_wp_element_["createRef"])();
  8293. return _this;
  8294. }
  8295. Object(createClass["a" /* default */])(PostPublishPanelPostpublish, [{
  8296. key: "componentDidMount",
  8297. value: function componentDidMount() {
  8298. if (this.props.focusOnMount) {
  8299. this.postLink.current.focus();
  8300. }
  8301. }
  8302. }, {
  8303. key: "componentWillUnmount",
  8304. value: function componentWillUnmount() {
  8305. clearTimeout(this.dismissCopyConfirmation);
  8306. }
  8307. }, {
  8308. key: "onCopy",
  8309. value: function onCopy() {
  8310. var _this2 = this;
  8311. this.setState({
  8312. showCopyConfirmation: true
  8313. });
  8314. clearTimeout(this.dismissCopyConfirmation);
  8315. this.dismissCopyConfirmation = setTimeout(function () {
  8316. _this2.setState({
  8317. showCopyConfirmation: false
  8318. });
  8319. }, 4000);
  8320. }
  8321. }, {
  8322. key: "onSelectInput",
  8323. value: function onSelectInput(event) {
  8324. event.target.select();
  8325. }
  8326. }, {
  8327. key: "render",
  8328. value: function render() {
  8329. var _this$props = this.props,
  8330. children = _this$props.children,
  8331. isScheduled = _this$props.isScheduled,
  8332. post = _this$props.post,
  8333. postType = _this$props.postType;
  8334. var postLabel = Object(external_lodash_["get"])(postType, ['labels', 'singular_name']);
  8335. var viewPostLabel = Object(external_lodash_["get"])(postType, ['labels', 'view_item']);
  8336. var postPublishNonLinkHeader = isScheduled ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_i18n_["__"])('is now scheduled. It will go live on'), " ", Object(external_this_wp_element_["createElement"])(post_schedule_label, null), ".") : Object(external_this_wp_i18n_["__"])('is now live.');
  8337. return Object(external_this_wp_element_["createElement"])("div", {
  8338. className: "post-publish-panel__postpublish"
  8339. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], {
  8340. className: "post-publish-panel__postpublish-header"
  8341. }, Object(external_this_wp_element_["createElement"])("a", {
  8342. ref: this.postLink,
  8343. href: post.link
  8344. }, post.title || Object(external_this_wp_i18n_["__"])('(no title)')), " ", postPublishNonLinkHeader), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], null, Object(external_this_wp_element_["createElement"])("p", {
  8345. className: "post-publish-panel__postpublish-subheader"
  8346. }, Object(external_this_wp_element_["createElement"])("strong", null, Object(external_this_wp_i18n_["__"])('What’s next?'))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], {
  8347. className: "post-publish-panel__postpublish-post-address",
  8348. readOnly: true,
  8349. label: Object(external_this_wp_i18n_["sprintf"])(
  8350. /* translators: %s: post type singular name */
  8351. Object(external_this_wp_i18n_["__"])('%s address'), postLabel),
  8352. value: Object(external_this_wp_url_["safeDecodeURIComponent"])(post.link),
  8353. onFocus: this.onSelectInput
  8354. }), Object(external_this_wp_element_["createElement"])("div", {
  8355. className: "post-publish-panel__postpublish-buttons"
  8356. }, !isScheduled && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  8357. isDefault: true,
  8358. href: post.link
  8359. }, viewPostLabel), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], {
  8360. isDefault: true,
  8361. text: post.link,
  8362. onCopy: this.onCopy
  8363. }, this.state.showCopyConfirmation ? Object(external_this_wp_i18n_["__"])('Copied!') : Object(external_this_wp_i18n_["__"])('Copy Link')))), children);
  8364. }
  8365. }]);
  8366. return PostPublishPanelPostpublish;
  8367. }(external_this_wp_element_["Component"]);
  8368. /* harmony default export */ var postpublish = (Object(external_this_wp_data_["withSelect"])(function (select) {
  8369. var _select = select('core/editor'),
  8370. getEditedPostAttribute = _select.getEditedPostAttribute,
  8371. getCurrentPost = _select.getCurrentPost,
  8372. isCurrentPostScheduled = _select.isCurrentPostScheduled;
  8373. var _select2 = select('core'),
  8374. getPostType = _select2.getPostType;
  8375. return {
  8376. post: getCurrentPost(),
  8377. postType: getPostType(getEditedPostAttribute('type')),
  8378. isScheduled: isCurrentPostScheduled()
  8379. };
  8380. })(postpublish_PostPublishPanelPostpublish));
  8381. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js
  8382. /**
  8383. * External dependencies
  8384. */
  8385. /**
  8386. * WordPress dependencies
  8387. */
  8388. /**
  8389. * Internal dependencies
  8390. */
  8391. var post_publish_panel_PostPublishPanel =
  8392. /*#__PURE__*/
  8393. function (_Component) {
  8394. Object(inherits["a" /* default */])(PostPublishPanel, _Component);
  8395. function PostPublishPanel() {
  8396. var _this;
  8397. Object(classCallCheck["a" /* default */])(this, PostPublishPanel);
  8398. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPublishPanel).apply(this, arguments));
  8399. _this.onSubmit = _this.onSubmit.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8400. return _this;
  8401. }
  8402. Object(createClass["a" /* default */])(PostPublishPanel, [{
  8403. key: "componentDidUpdate",
  8404. value: function componentDidUpdate(prevProps) {
  8405. // Automatically collapse the publish sidebar when a post
  8406. // is published and the user makes an edit.
  8407. if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty) {
  8408. this.props.onClose();
  8409. }
  8410. }
  8411. }, {
  8412. key: "onSubmit",
  8413. value: function onSubmit() {
  8414. var _this$props = this.props,
  8415. onClose = _this$props.onClose,
  8416. hasPublishAction = _this$props.hasPublishAction,
  8417. isPostTypeViewable = _this$props.isPostTypeViewable;
  8418. if (!hasPublishAction || !isPostTypeViewable) {
  8419. onClose();
  8420. }
  8421. }
  8422. }, {
  8423. key: "render",
  8424. value: function render() {
  8425. var _this$props2 = this.props,
  8426. forceIsDirty = _this$props2.forceIsDirty,
  8427. forceIsSaving = _this$props2.forceIsSaving,
  8428. isBeingScheduled = _this$props2.isBeingScheduled,
  8429. isPublished = _this$props2.isPublished,
  8430. isPublishSidebarEnabled = _this$props2.isPublishSidebarEnabled,
  8431. isScheduled = _this$props2.isScheduled,
  8432. isSaving = _this$props2.isSaving,
  8433. onClose = _this$props2.onClose,
  8434. onTogglePublishSidebar = _this$props2.onTogglePublishSidebar,
  8435. PostPublishExtension = _this$props2.PostPublishExtension,
  8436. PrePublishExtension = _this$props2.PrePublishExtension,
  8437. additionalProps = Object(objectWithoutProperties["a" /* default */])(_this$props2, ["forceIsDirty", "forceIsSaving", "isBeingScheduled", "isPublished", "isPublishSidebarEnabled", "isScheduled", "isSaving", "onClose", "onTogglePublishSidebar", "PostPublishExtension", "PrePublishExtension"]);
  8438. var propsForPanel = Object(external_lodash_["omit"])(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']);
  8439. var isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled;
  8440. var isPrePublish = !isPublishedOrScheduled && !isSaving;
  8441. var isPostPublish = isPublishedOrScheduled && !isSaving;
  8442. return Object(external_this_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({
  8443. className: "editor-post-publish-panel"
  8444. }, propsForPanel), Object(external_this_wp_element_["createElement"])("div", {
  8445. className: "editor-post-publish-panel__header"
  8446. }, isPostPublish ? Object(external_this_wp_element_["createElement"])("div", {
  8447. className: "editor-post-publish-panel__header-published"
  8448. }, isScheduled ? Object(external_this_wp_i18n_["__"])('Scheduled') : Object(external_this_wp_i18n_["__"])('Published')) : Object(external_this_wp_element_["createElement"])("div", {
  8449. className: "editor-post-publish-panel__header-publish-button"
  8450. }, Object(external_this_wp_element_["createElement"])(post_publish_button, {
  8451. focusOnMount: true,
  8452. onSubmit: this.onSubmit,
  8453. forceIsDirty: forceIsDirty,
  8454. forceIsSaving: forceIsSaving
  8455. }), Object(external_this_wp_element_["createElement"])("span", {
  8456. className: "editor-post-publish-panel__spacer"
  8457. })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], {
  8458. "aria-expanded": true,
  8459. onClick: onClose,
  8460. icon: "no-alt",
  8461. label: Object(external_this_wp_i18n_["__"])('Close panel')
  8462. })), Object(external_this_wp_element_["createElement"])("div", {
  8463. className: "editor-post-publish-panel__content"
  8464. }, isPrePublish && Object(external_this_wp_element_["createElement"])(prepublish, null, PrePublishExtension && Object(external_this_wp_element_["createElement"])(PrePublishExtension, null)), isPostPublish && Object(external_this_wp_element_["createElement"])(postpublish, {
  8465. focusOnMount: true
  8466. }, PostPublishExtension && Object(external_this_wp_element_["createElement"])(PostPublishExtension, null)), isSaving && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null)), Object(external_this_wp_element_["createElement"])("div", {
  8467. className: "editor-post-publish-panel__footer"
  8468. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], {
  8469. label: Object(external_this_wp_i18n_["__"])('Always show pre-publish checks.'),
  8470. checked: isPublishSidebarEnabled,
  8471. onChange: onTogglePublishSidebar
  8472. })));
  8473. }
  8474. }]);
  8475. return PostPublishPanel;
  8476. }(external_this_wp_element_["Component"]);
  8477. /* harmony default export */ var post_publish_panel = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  8478. var _select = select('core'),
  8479. getPostType = _select.getPostType;
  8480. var _select2 = select('core/editor'),
  8481. getCurrentPost = _select2.getCurrentPost,
  8482. getEditedPostAttribute = _select2.getEditedPostAttribute,
  8483. isCurrentPostPublished = _select2.isCurrentPostPublished,
  8484. isCurrentPostScheduled = _select2.isCurrentPostScheduled,
  8485. isEditedPostBeingScheduled = _select2.isEditedPostBeingScheduled,
  8486. isEditedPostDirty = _select2.isEditedPostDirty,
  8487. isSavingPost = _select2.isSavingPost;
  8488. var _select3 = select('core/editor'),
  8489. isPublishSidebarEnabled = _select3.isPublishSidebarEnabled;
  8490. var postType = getPostType(getEditedPostAttribute('type'));
  8491. return {
  8492. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  8493. isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false),
  8494. isBeingScheduled: isEditedPostBeingScheduled(),
  8495. isDirty: isEditedPostDirty(),
  8496. isPublished: isCurrentPostPublished(),
  8497. isPublishSidebarEnabled: isPublishSidebarEnabled(),
  8498. isSaving: isSavingPost(),
  8499. isScheduled: isCurrentPostScheduled()
  8500. };
  8501. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref) {
  8502. var isPublishSidebarEnabled = _ref.isPublishSidebarEnabled;
  8503. var _dispatch = dispatch('core/editor'),
  8504. disablePublishSidebar = _dispatch.disablePublishSidebar,
  8505. enablePublishSidebar = _dispatch.enablePublishSidebar;
  8506. return {
  8507. onTogglePublishSidebar: function onTogglePublishSidebar() {
  8508. if (isPublishSidebarEnabled) {
  8509. disablePublishSidebar();
  8510. } else {
  8511. enablePublishSidebar();
  8512. }
  8513. }
  8514. };
  8515. }), external_this_wp_components_["withFocusReturn"], external_this_wp_components_["withConstrainedTabbing"]])(post_publish_panel_PostPublishPanel));
  8516. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js
  8517. /**
  8518. * WordPress dependencies
  8519. */
  8520. function PostSwitchToDraftButton(_ref) {
  8521. var isSaving = _ref.isSaving,
  8522. isPublished = _ref.isPublished,
  8523. isScheduled = _ref.isScheduled,
  8524. onClick = _ref.onClick,
  8525. isMobileViewport = _ref.isMobileViewport;
  8526. if (!isPublished && !isScheduled) {
  8527. return null;
  8528. }
  8529. var onSwitch = function onSwitch() {
  8530. var alertMessage;
  8531. if (isPublished) {
  8532. alertMessage = Object(external_this_wp_i18n_["__"])('Are you sure you want to unpublish this post?');
  8533. } else if (isScheduled) {
  8534. alertMessage = Object(external_this_wp_i18n_["__"])('Are you sure you want to unschedule this post?');
  8535. } // eslint-disable-next-line no-alert
  8536. if (window.confirm(alertMessage)) {
  8537. onClick();
  8538. }
  8539. };
  8540. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  8541. className: "editor-post-switch-to-draft",
  8542. onClick: onSwitch,
  8543. disabled: isSaving,
  8544. isTertiary: true
  8545. }, isMobileViewport ? Object(external_this_wp_i18n_["__"])('Draft') : Object(external_this_wp_i18n_["__"])('Switch to Draft'));
  8546. }
  8547. /* harmony default export */ var post_switch_to_draft_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  8548. var _select = select('core/editor'),
  8549. isSavingPost = _select.isSavingPost,
  8550. isCurrentPostPublished = _select.isCurrentPostPublished,
  8551. isCurrentPostScheduled = _select.isCurrentPostScheduled;
  8552. return {
  8553. isSaving: isSavingPost(),
  8554. isPublished: isCurrentPostPublished(),
  8555. isScheduled: isCurrentPostScheduled()
  8556. };
  8557. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  8558. var _dispatch = dispatch('core/editor'),
  8559. editPost = _dispatch.editPost,
  8560. savePost = _dispatch.savePost;
  8561. return {
  8562. onClick: function onClick() {
  8563. editPost({
  8564. status: 'draft'
  8565. });
  8566. savePost();
  8567. }
  8568. };
  8569. }), Object(external_this_wp_viewport_["withViewportMatch"])({
  8570. isMobileViewport: '< small'
  8571. })])(PostSwitchToDraftButton));
  8572. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js
  8573. /**
  8574. * External dependencies
  8575. */
  8576. /**
  8577. * WordPress dependencies
  8578. */
  8579. /**
  8580. * Internal dependencies
  8581. */
  8582. /**
  8583. * Component showing whether the post is saved or not and displaying save links.
  8584. *
  8585. * @param {Object} Props Component Props.
  8586. */
  8587. var post_saved_state_PostSavedState =
  8588. /*#__PURE__*/
  8589. function (_Component) {
  8590. Object(inherits["a" /* default */])(PostSavedState, _Component);
  8591. function PostSavedState() {
  8592. var _this;
  8593. Object(classCallCheck["a" /* default */])(this, PostSavedState);
  8594. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostSavedState).apply(this, arguments));
  8595. _this.state = {
  8596. forceSavedMessage: false
  8597. };
  8598. return _this;
  8599. }
  8600. Object(createClass["a" /* default */])(PostSavedState, [{
  8601. key: "componentDidUpdate",
  8602. value: function componentDidUpdate(prevProps) {
  8603. var _this2 = this;
  8604. if (prevProps.isSaving && !this.props.isSaving) {
  8605. this.setState({
  8606. forceSavedMessage: true
  8607. });
  8608. this.props.setTimeout(function () {
  8609. _this2.setState({
  8610. forceSavedMessage: false
  8611. });
  8612. }, 1000);
  8613. }
  8614. }
  8615. }, {
  8616. key: "render",
  8617. value: function render() {
  8618. var _this$props = this.props,
  8619. post = _this$props.post,
  8620. isNew = _this$props.isNew,
  8621. isScheduled = _this$props.isScheduled,
  8622. isPublished = _this$props.isPublished,
  8623. isDirty = _this$props.isDirty,
  8624. isSaving = _this$props.isSaving,
  8625. isSaveable = _this$props.isSaveable,
  8626. onSave = _this$props.onSave,
  8627. isAutosaving = _this$props.isAutosaving,
  8628. isPending = _this$props.isPending,
  8629. isLargeViewport = _this$props.isLargeViewport;
  8630. var forceSavedMessage = this.state.forceSavedMessage;
  8631. if (isSaving) {
  8632. // TODO: Classes generation should be common across all return
  8633. // paths of this function, including proper naming convention for
  8634. // the "Save Draft" button.
  8635. var classes = classnames_default()('editor-post-saved-state', 'is-saving', {
  8636. 'is-autosaving': isAutosaving
  8637. });
  8638. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Animate"], {
  8639. type: "loading"
  8640. }, function (_ref) {
  8641. var animateClassName = _ref.className;
  8642. return Object(external_this_wp_element_["createElement"])("span", {
  8643. className: classnames_default()(classes, animateClassName)
  8644. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dashicon"], {
  8645. icon: "cloud"
  8646. }), isAutosaving ? Object(external_this_wp_i18n_["__"])('Autosaving') : Object(external_this_wp_i18n_["__"])('Saving'));
  8647. });
  8648. }
  8649. if (isPublished || isScheduled) {
  8650. return Object(external_this_wp_element_["createElement"])(post_switch_to_draft_button, null);
  8651. }
  8652. if (!isSaveable) {
  8653. return null;
  8654. }
  8655. if (forceSavedMessage || !isNew && !isDirty) {
  8656. return Object(external_this_wp_element_["createElement"])("span", {
  8657. className: "editor-post-saved-state is-saved"
  8658. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dashicon"], {
  8659. icon: "saved"
  8660. }), Object(external_this_wp_i18n_["__"])('Saved'));
  8661. } // Once the post has been submitted for review this button
  8662. // is not needed for the contributor role.
  8663. var hasPublishAction = Object(external_lodash_["get"])(post, ['_links', 'wp:action-publish'], false);
  8664. if (!hasPublishAction && isPending) {
  8665. return null;
  8666. }
  8667. var label = isPending ? Object(external_this_wp_i18n_["__"])('Save as Pending') : Object(external_this_wp_i18n_["__"])('Save Draft');
  8668. if (!isLargeViewport) {
  8669. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], {
  8670. className: "editor-post-save-draft",
  8671. label: label,
  8672. onClick: function onClick() {
  8673. return onSave();
  8674. },
  8675. shortcut: external_this_wp_keycodes_["displayShortcut"].primary('s'),
  8676. icon: "cloud-upload"
  8677. });
  8678. }
  8679. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  8680. className: "editor-post-save-draft",
  8681. onClick: function onClick() {
  8682. return onSave();
  8683. },
  8684. shortcut: external_this_wp_keycodes_["displayShortcut"].primary('s'),
  8685. isTertiary: true
  8686. }, label);
  8687. }
  8688. }]);
  8689. return PostSavedState;
  8690. }(external_this_wp_element_["Component"]);
  8691. /* harmony default export */ var post_saved_state = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) {
  8692. var forceIsDirty = _ref2.forceIsDirty,
  8693. forceIsSaving = _ref2.forceIsSaving;
  8694. var _select = select('core/editor'),
  8695. isEditedPostNew = _select.isEditedPostNew,
  8696. isCurrentPostPublished = _select.isCurrentPostPublished,
  8697. isCurrentPostScheduled = _select.isCurrentPostScheduled,
  8698. isEditedPostDirty = _select.isEditedPostDirty,
  8699. isSavingPost = _select.isSavingPost,
  8700. isEditedPostSaveable = _select.isEditedPostSaveable,
  8701. getCurrentPost = _select.getCurrentPost,
  8702. isAutosavingPost = _select.isAutosavingPost,
  8703. getEditedPostAttribute = _select.getEditedPostAttribute;
  8704. return {
  8705. post: getCurrentPost(),
  8706. isNew: isEditedPostNew(),
  8707. isPublished: isCurrentPostPublished(),
  8708. isScheduled: isCurrentPostScheduled(),
  8709. isDirty: forceIsDirty || isEditedPostDirty(),
  8710. isSaving: forceIsSaving || isSavingPost(),
  8711. isSaveable: isEditedPostSaveable(),
  8712. isAutosaving: isAutosavingPost(),
  8713. isPending: 'pending' === getEditedPostAttribute('status')
  8714. };
  8715. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  8716. return {
  8717. onSave: dispatch('core/editor').savePost
  8718. };
  8719. }), external_this_wp_compose_["withSafeTimeout"], Object(external_this_wp_viewport_["withViewportMatch"])({
  8720. isLargeViewport: 'small'
  8721. })])(post_saved_state_PostSavedState));
  8722. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js
  8723. /**
  8724. * External dependencies
  8725. */
  8726. /**
  8727. * WordPress dependencies
  8728. */
  8729. function PostScheduleCheck(_ref) {
  8730. var hasPublishAction = _ref.hasPublishAction,
  8731. children = _ref.children;
  8732. if (!hasPublishAction) {
  8733. return null;
  8734. }
  8735. return children;
  8736. }
  8737. /* harmony default export */ var post_schedule_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  8738. var _select = select('core/editor'),
  8739. getCurrentPost = _select.getCurrentPost,
  8740. getCurrentPostType = _select.getCurrentPostType;
  8741. return {
  8742. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  8743. postType: getCurrentPostType()
  8744. };
  8745. })])(PostScheduleCheck));
  8746. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js
  8747. /**
  8748. * External dependencies
  8749. */
  8750. /**
  8751. * WordPress dependencies
  8752. */
  8753. function PostStickyCheck(_ref) {
  8754. var hasStickyAction = _ref.hasStickyAction,
  8755. postType = _ref.postType,
  8756. children = _ref.children;
  8757. if (postType !== 'post' || !hasStickyAction) {
  8758. return null;
  8759. }
  8760. return children;
  8761. }
  8762. /* harmony default export */ var post_sticky_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  8763. var post = select('core/editor').getCurrentPost();
  8764. return {
  8765. hasStickyAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-sticky'], false),
  8766. postType: select('core/editor').getCurrentPostType()
  8767. };
  8768. })])(PostStickyCheck));
  8769. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js
  8770. /**
  8771. * WordPress dependencies
  8772. */
  8773. /**
  8774. * Internal dependencies
  8775. */
  8776. function PostSticky(_ref) {
  8777. var onUpdateSticky = _ref.onUpdateSticky,
  8778. _ref$postSticky = _ref.postSticky,
  8779. postSticky = _ref$postSticky === void 0 ? false : _ref$postSticky;
  8780. return Object(external_this_wp_element_["createElement"])(post_sticky_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], {
  8781. label: Object(external_this_wp_i18n_["__"])('Stick to the top of the blog'),
  8782. checked: postSticky,
  8783. onChange: function onChange() {
  8784. return onUpdateSticky(!postSticky);
  8785. }
  8786. }));
  8787. }
  8788. /* harmony default export */ var post_sticky = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  8789. return {
  8790. postSticky: select('core/editor').getEditedPostAttribute('sticky')
  8791. };
  8792. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  8793. return {
  8794. onUpdateSticky: function onUpdateSticky(postSticky) {
  8795. dispatch('core/editor').editPost({
  8796. sticky: postSticky
  8797. });
  8798. }
  8799. };
  8800. })])(PostSticky));
  8801. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js
  8802. /**
  8803. * External dependencies
  8804. */
  8805. /**
  8806. * WordPress dependencies
  8807. */
  8808. /**
  8809. * Internal dependencies
  8810. */
  8811. /**
  8812. * Module Constants
  8813. */
  8814. var hierarchical_term_selector_DEFAULT_QUERY = {
  8815. per_page: -1,
  8816. orderby: 'name',
  8817. order: 'asc',
  8818. _fields: 'id,name,parent'
  8819. };
  8820. var MIN_TERMS_COUNT_FOR_FILTER = 8;
  8821. var hierarchical_term_selector_HierarchicalTermSelector =
  8822. /*#__PURE__*/
  8823. function (_Component) {
  8824. Object(inherits["a" /* default */])(HierarchicalTermSelector, _Component);
  8825. function HierarchicalTermSelector() {
  8826. var _this;
  8827. Object(classCallCheck["a" /* default */])(this, HierarchicalTermSelector);
  8828. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(HierarchicalTermSelector).apply(this, arguments));
  8829. _this.findTerm = _this.findTerm.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8830. _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8831. _this.onChangeFormName = _this.onChangeFormName.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8832. _this.onChangeFormParent = _this.onChangeFormParent.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8833. _this.onAddTerm = _this.onAddTerm.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8834. _this.onToggleForm = _this.onToggleForm.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8835. _this.setFilterValue = _this.setFilterValue.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8836. _this.sortBySelected = _this.sortBySelected.bind(Object(assertThisInitialized["a" /* default */])(_this));
  8837. _this.state = {
  8838. loading: true,
  8839. availableTermsTree: [],
  8840. availableTerms: [],
  8841. adding: false,
  8842. formName: '',
  8843. formParent: '',
  8844. showForm: false,
  8845. filterValue: '',
  8846. filteredTermsTree: []
  8847. };
  8848. return _this;
  8849. }
  8850. Object(createClass["a" /* default */])(HierarchicalTermSelector, [{
  8851. key: "onChange",
  8852. value: function onChange(termId) {
  8853. var _this$props = this.props,
  8854. onUpdateTerms = _this$props.onUpdateTerms,
  8855. _this$props$terms = _this$props.terms,
  8856. terms = _this$props$terms === void 0 ? [] : _this$props$terms,
  8857. taxonomy = _this$props.taxonomy;
  8858. var hasTerm = terms.indexOf(termId) !== -1;
  8859. var newTerms = hasTerm ? Object(external_lodash_["without"])(terms, termId) : [].concat(Object(toConsumableArray["a" /* default */])(terms), [termId]);
  8860. onUpdateTerms(newTerms, taxonomy.rest_base);
  8861. }
  8862. }, {
  8863. key: "onChangeFormName",
  8864. value: function onChangeFormName(event) {
  8865. var newValue = event.target.value.trim() === '' ? '' : event.target.value;
  8866. this.setState({
  8867. formName: newValue
  8868. });
  8869. }
  8870. }, {
  8871. key: "onChangeFormParent",
  8872. value: function onChangeFormParent(newParent) {
  8873. this.setState({
  8874. formParent: newParent
  8875. });
  8876. }
  8877. }, {
  8878. key: "onToggleForm",
  8879. value: function onToggleForm() {
  8880. this.setState(function (state) {
  8881. return {
  8882. showForm: !state.showForm
  8883. };
  8884. });
  8885. }
  8886. }, {
  8887. key: "findTerm",
  8888. value: function findTerm(terms, parent, name) {
  8889. return Object(external_lodash_["find"])(terms, function (term) {
  8890. return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase();
  8891. });
  8892. }
  8893. }, {
  8894. key: "onAddTerm",
  8895. value: function onAddTerm(event) {
  8896. var _this2 = this;
  8897. event.preventDefault();
  8898. var _this$props2 = this.props,
  8899. onUpdateTerms = _this$props2.onUpdateTerms,
  8900. taxonomy = _this$props2.taxonomy,
  8901. terms = _this$props2.terms,
  8902. slug = _this$props2.slug;
  8903. var _this$state = this.state,
  8904. formName = _this$state.formName,
  8905. formParent = _this$state.formParent,
  8906. adding = _this$state.adding,
  8907. availableTerms = _this$state.availableTerms;
  8908. if (formName === '' || adding) {
  8909. return;
  8910. } // check if the term we are adding already exists
  8911. var existingTerm = this.findTerm(availableTerms, formParent, formName);
  8912. if (existingTerm) {
  8913. // if the term we are adding exists but is not selected select it
  8914. if (!Object(external_lodash_["some"])(terms, function (term) {
  8915. return term === existingTerm.id;
  8916. })) {
  8917. onUpdateTerms([].concat(Object(toConsumableArray["a" /* default */])(terms), [existingTerm.id]), taxonomy.rest_base);
  8918. }
  8919. this.setState({
  8920. formName: '',
  8921. formParent: ''
  8922. });
  8923. return;
  8924. }
  8925. this.setState({
  8926. adding: true
  8927. });
  8928. this.addRequest = external_this_wp_apiFetch_default()({
  8929. path: "/wp/v2/".concat(taxonomy.rest_base),
  8930. method: 'POST',
  8931. data: {
  8932. name: formName,
  8933. parent: formParent ? formParent : undefined
  8934. }
  8935. }); // Tries to create a term or fetch it if it already exists
  8936. var findOrCreatePromise = this.addRequest.catch(function (error) {
  8937. var errorCode = error.code;
  8938. if (errorCode === 'term_exists') {
  8939. // search the new category created since last fetch
  8940. _this2.addRequest = external_this_wp_apiFetch_default()({
  8941. path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), Object(objectSpread["a" /* default */])({}, hierarchical_term_selector_DEFAULT_QUERY, {
  8942. parent: formParent || 0,
  8943. search: formName
  8944. }))
  8945. });
  8946. return _this2.addRequest.then(function (searchResult) {
  8947. return _this2.findTerm(searchResult, formParent, formName);
  8948. });
  8949. }
  8950. return Promise.reject(error);
  8951. });
  8952. findOrCreatePromise.then(function (term) {
  8953. var hasTerm = !!Object(external_lodash_["find"])(_this2.state.availableTerms, function (availableTerm) {
  8954. return availableTerm.id === term.id;
  8955. });
  8956. var newAvailableTerms = hasTerm ? _this2.state.availableTerms : [term].concat(Object(toConsumableArray["a" /* default */])(_this2.state.availableTerms));
  8957. var termAddedMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(_this2.props.taxonomy, ['labels', 'singular_name'], slug === 'category' ? Object(external_this_wp_i18n_["__"])('Category') : Object(external_this_wp_i18n_["__"])('Term')));
  8958. _this2.props.speak(termAddedMessage, 'assertive');
  8959. _this2.addRequest = null;
  8960. _this2.setState({
  8961. adding: false,
  8962. formName: '',
  8963. formParent: '',
  8964. availableTerms: newAvailableTerms,
  8965. availableTermsTree: _this2.sortBySelected(buildTermsTree(newAvailableTerms))
  8966. });
  8967. onUpdateTerms([].concat(Object(toConsumableArray["a" /* default */])(terms), [term.id]), taxonomy.rest_base);
  8968. }, function (xhr) {
  8969. if (xhr.statusText === 'abort') {
  8970. return;
  8971. }
  8972. _this2.addRequest = null;
  8973. _this2.setState({
  8974. adding: false
  8975. });
  8976. });
  8977. }
  8978. }, {
  8979. key: "componentDidMount",
  8980. value: function componentDidMount() {
  8981. this.fetchTerms();
  8982. }
  8983. }, {
  8984. key: "componentWillUnmount",
  8985. value: function componentWillUnmount() {
  8986. Object(external_lodash_["invoke"])(this.fetchRequest, ['abort']);
  8987. Object(external_lodash_["invoke"])(this.addRequest, ['abort']);
  8988. }
  8989. }, {
  8990. key: "componentDidUpdate",
  8991. value: function componentDidUpdate(prevProps) {
  8992. if (this.props.taxonomy !== prevProps.taxonomy) {
  8993. this.fetchTerms();
  8994. }
  8995. }
  8996. }, {
  8997. key: "fetchTerms",
  8998. value: function fetchTerms() {
  8999. var _this3 = this;
  9000. var taxonomy = this.props.taxonomy;
  9001. if (!taxonomy) {
  9002. return;
  9003. }
  9004. this.fetchRequest = external_this_wp_apiFetch_default()({
  9005. path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), hierarchical_term_selector_DEFAULT_QUERY)
  9006. });
  9007. this.fetchRequest.then(function (terms) {
  9008. // resolve
  9009. var availableTermsTree = _this3.sortBySelected(buildTermsTree(terms));
  9010. _this3.fetchRequest = null;
  9011. _this3.setState({
  9012. loading: false,
  9013. availableTermsTree: availableTermsTree,
  9014. availableTerms: terms
  9015. });
  9016. }, function (xhr) {
  9017. // reject
  9018. if (xhr.statusText === 'abort') {
  9019. return;
  9020. }
  9021. _this3.fetchRequest = null;
  9022. _this3.setState({
  9023. loading: false
  9024. });
  9025. });
  9026. }
  9027. }, {
  9028. key: "sortBySelected",
  9029. value: function sortBySelected(termsTree) {
  9030. var terms = this.props.terms;
  9031. var treeHasSelection = function treeHasSelection(termTree) {
  9032. if (terms.indexOf(termTree.id) !== -1) {
  9033. return true;
  9034. }
  9035. if (undefined === termTree.children) {
  9036. return false;
  9037. }
  9038. var anyChildIsSelected = termTree.children.map(treeHasSelection).filter(function (child) {
  9039. return child;
  9040. }).length > 0;
  9041. if (anyChildIsSelected) {
  9042. return true;
  9043. }
  9044. return false;
  9045. };
  9046. var termOrChildIsSelected = function termOrChildIsSelected(termA, termB) {
  9047. var termASelected = treeHasSelection(termA);
  9048. var termBSelected = treeHasSelection(termB);
  9049. if (termASelected === termBSelected) {
  9050. return 0;
  9051. }
  9052. if (termASelected && !termBSelected) {
  9053. return -1;
  9054. }
  9055. if (!termASelected && termBSelected) {
  9056. return 1;
  9057. }
  9058. return 0;
  9059. };
  9060. termsTree.sort(termOrChildIsSelected);
  9061. return termsTree;
  9062. }
  9063. }, {
  9064. key: "setFilterValue",
  9065. value: function setFilterValue(event) {
  9066. var availableTermsTree = this.state.availableTermsTree;
  9067. var filterValue = event.target.value;
  9068. var filteredTermsTree = availableTermsTree.map(this.getFilterMatcher(filterValue)).filter(function (term) {
  9069. return term;
  9070. });
  9071. var getResultCount = function getResultCount(terms) {
  9072. var count = 0;
  9073. for (var i = 0; i < terms.length; i++) {
  9074. count++;
  9075. if (undefined !== terms[i].children) {
  9076. count += getResultCount(terms[i].children);
  9077. }
  9078. }
  9079. return count;
  9080. };
  9081. this.setState({
  9082. filterValue: filterValue,
  9083. filteredTermsTree: filteredTermsTree
  9084. });
  9085. var resultCount = getResultCount(filteredTermsTree);
  9086. var resultsFoundMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d result found.', '%d results found.', resultCount), resultCount);
  9087. this.props.debouncedSpeak(resultsFoundMessage, 'assertive');
  9088. }
  9089. }, {
  9090. key: "getFilterMatcher",
  9091. value: function getFilterMatcher(filterValue) {
  9092. var matchTermsForFilter = function matchTermsForFilter(originalTerm) {
  9093. if ('' === filterValue) {
  9094. return originalTerm;
  9095. } // Shallow clone, because we'll be filtering the term's children and
  9096. // don't want to modify the original term.
  9097. var term = Object(objectSpread["a" /* default */])({}, originalTerm); // Map and filter the children, recursive so we deal with grandchildren
  9098. // and any deeper levels.
  9099. if (term.children.length > 0) {
  9100. term.children = term.children.map(matchTermsForFilter).filter(function (child) {
  9101. return child;
  9102. });
  9103. } // If the term's name contains the filterValue, or it has children
  9104. // (i.e. some child matched at some point in the tree) then return it.
  9105. if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) {
  9106. return term;
  9107. } // Otherwise, return false. After mapping, the list of terms will need
  9108. // to have false values filtered out.
  9109. return false;
  9110. };
  9111. return matchTermsForFilter;
  9112. }
  9113. }, {
  9114. key: "renderTerms",
  9115. value: function renderTerms(renderedTerms) {
  9116. var _this4 = this;
  9117. var _this$props$terms2 = this.props.terms,
  9118. terms = _this$props$terms2 === void 0 ? [] : _this$props$terms2;
  9119. return renderedTerms.map(function (term) {
  9120. return Object(external_this_wp_element_["createElement"])("div", {
  9121. key: term.id,
  9122. className: "editor-post-taxonomies__hierarchical-terms-choice"
  9123. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], {
  9124. checked: terms.indexOf(term.id) !== -1,
  9125. onChange: function onChange() {
  9126. var termId = parseInt(term.id, 10);
  9127. _this4.onChange(termId);
  9128. },
  9129. label: Object(external_lodash_["unescape"])(term.name)
  9130. }), !!term.children.length && Object(external_this_wp_element_["createElement"])("div", {
  9131. className: "editor-post-taxonomies__hierarchical-terms-subchoices"
  9132. }, _this4.renderTerms(term.children)));
  9133. });
  9134. }
  9135. }, {
  9136. key: "render",
  9137. value: function render() {
  9138. var _this$props3 = this.props,
  9139. slug = _this$props3.slug,
  9140. taxonomy = _this$props3.taxonomy,
  9141. instanceId = _this$props3.instanceId,
  9142. hasCreateAction = _this$props3.hasCreateAction,
  9143. hasAssignAction = _this$props3.hasAssignAction;
  9144. if (!hasAssignAction) {
  9145. return null;
  9146. }
  9147. var _this$state2 = this.state,
  9148. availableTermsTree = _this$state2.availableTermsTree,
  9149. availableTerms = _this$state2.availableTerms,
  9150. filteredTermsTree = _this$state2.filteredTermsTree,
  9151. formName = _this$state2.formName,
  9152. formParent = _this$state2.formParent,
  9153. loading = _this$state2.loading,
  9154. showForm = _this$state2.showForm,
  9155. filterValue = _this$state2.filterValue;
  9156. var labelWithFallback = function labelWithFallback(labelProperty, fallbackIsCategory, fallbackIsNotCategory) {
  9157. return Object(external_lodash_["get"])(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory);
  9158. };
  9159. var newTermButtonLabel = labelWithFallback('add_new_item', Object(external_this_wp_i18n_["__"])('Add new category'), Object(external_this_wp_i18n_["__"])('Add new term'));
  9160. var newTermLabel = labelWithFallback('new_item_name', Object(external_this_wp_i18n_["__"])('Add new category'), Object(external_this_wp_i18n_["__"])('Add new term'));
  9161. var parentSelectLabel = labelWithFallback('parent_item', Object(external_this_wp_i18n_["__"])('Parent Category'), Object(external_this_wp_i18n_["__"])('Parent Term'));
  9162. var noParentOption = "\u2014 ".concat(parentSelectLabel, " \u2014");
  9163. var newTermSubmitLabel = newTermButtonLabel;
  9164. var inputId = "editor-post-taxonomies__hierarchical-terms-input-".concat(instanceId);
  9165. var filterInputId = "editor-post-taxonomies__hierarchical-terms-filter-".concat(instanceId);
  9166. var filterLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'search_items'], Object(external_this_wp_i18n_["__"])('Search Terms'));
  9167. var groupLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['name'], Object(external_this_wp_i18n_["__"])('Terms'));
  9168. var showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
  9169. return [showFilter && Object(external_this_wp_element_["createElement"])("label", {
  9170. key: "filter-label",
  9171. htmlFor: filterInputId
  9172. }, filterLabel), showFilter && Object(external_this_wp_element_["createElement"])("input", {
  9173. type: "search",
  9174. id: filterInputId,
  9175. value: filterValue,
  9176. onChange: this.setFilterValue,
  9177. className: "editor-post-taxonomies__hierarchical-terms-filter",
  9178. key: "term-filter-input"
  9179. }), Object(external_this_wp_element_["createElement"])("div", {
  9180. className: "editor-post-taxonomies__hierarchical-terms-list",
  9181. key: "term-list",
  9182. tabIndex: "0",
  9183. role: "group",
  9184. "aria-label": groupLabel
  9185. }, this.renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  9186. key: "term-add-button",
  9187. onClick: this.onToggleForm,
  9188. className: "editor-post-taxonomies__hierarchical-terms-add",
  9189. "aria-expanded": showForm,
  9190. isLink: true
  9191. }, newTermButtonLabel), showForm && Object(external_this_wp_element_["createElement"])("form", {
  9192. onSubmit: this.onAddTerm,
  9193. key: "hierarchical-terms-form"
  9194. }, Object(external_this_wp_element_["createElement"])("label", {
  9195. htmlFor: inputId,
  9196. className: "editor-post-taxonomies__hierarchical-terms-label"
  9197. }, newTermLabel), Object(external_this_wp_element_["createElement"])("input", {
  9198. type: "text",
  9199. id: inputId,
  9200. className: "editor-post-taxonomies__hierarchical-terms-input",
  9201. value: formName,
  9202. onChange: this.onChangeFormName,
  9203. required: true
  9204. }), !!availableTerms.length && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TreeSelect"], {
  9205. label: parentSelectLabel,
  9206. noOptionLabel: noParentOption,
  9207. onChange: this.onChangeFormParent,
  9208. selectedId: formParent,
  9209. tree: availableTermsTree
  9210. }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  9211. isDefault: true,
  9212. type: "submit",
  9213. className: "editor-post-taxonomies__hierarchical-terms-submit"
  9214. }, newTermSubmitLabel))];
  9215. }
  9216. }]);
  9217. return HierarchicalTermSelector;
  9218. }(external_this_wp_element_["Component"]);
  9219. /* harmony default export */ var hierarchical_term_selector = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref) {
  9220. var slug = _ref.slug;
  9221. var _select = select('core/editor'),
  9222. getCurrentPost = _select.getCurrentPost;
  9223. var _select2 = select('core'),
  9224. getTaxonomy = _select2.getTaxonomy;
  9225. var taxonomy = getTaxonomy(slug);
  9226. return {
  9227. hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false,
  9228. hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false,
  9229. terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [],
  9230. taxonomy: taxonomy
  9231. };
  9232. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  9233. return {
  9234. onUpdateTerms: function onUpdateTerms(terms, restBase) {
  9235. dispatch('core/editor').editPost(Object(defineProperty["a" /* default */])({}, restBase, terms));
  9236. }
  9237. };
  9238. }), external_this_wp_components_["withSpokenMessages"], external_this_wp_compose_["withInstanceId"], Object(external_this_wp_components_["withFilters"])('editor.PostTaxonomyType')])(hierarchical_term_selector_HierarchicalTermSelector));
  9239. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js
  9240. /**
  9241. * External dependencies
  9242. */
  9243. /**
  9244. * WordPress dependencies
  9245. */
  9246. /**
  9247. * Internal dependencies
  9248. */
  9249. function PostTaxonomies(_ref) {
  9250. var postType = _ref.postType,
  9251. taxonomies = _ref.taxonomies,
  9252. _ref$taxonomyWrapper = _ref.taxonomyWrapper,
  9253. taxonomyWrapper = _ref$taxonomyWrapper === void 0 ? external_lodash_["identity"] : _ref$taxonomyWrapper;
  9254. var availableTaxonomies = Object(external_lodash_["filter"])(taxonomies, function (taxonomy) {
  9255. return Object(external_lodash_["includes"])(taxonomy.types, postType);
  9256. });
  9257. var visibleTaxonomies = Object(external_lodash_["filter"])(availableTaxonomies, function (taxonomy) {
  9258. return taxonomy.visibility.show_ui;
  9259. });
  9260. return visibleTaxonomies.map(function (taxonomy) {
  9261. var TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector;
  9262. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], {
  9263. key: "taxonomy-".concat(taxonomy.slug)
  9264. }, taxonomyWrapper(Object(external_this_wp_element_["createElement"])(TaxonomyComponent, {
  9265. slug: taxonomy.slug
  9266. }), taxonomy));
  9267. });
  9268. }
  9269. /* harmony default export */ var post_taxonomies = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  9270. return {
  9271. postType: select('core/editor').getCurrentPostType(),
  9272. taxonomies: select('core').getTaxonomies({
  9273. per_page: -1
  9274. })
  9275. };
  9276. })])(PostTaxonomies));
  9277. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js
  9278. /**
  9279. * External dependencies
  9280. */
  9281. /**
  9282. * WordPress dependencies
  9283. */
  9284. function PostTaxonomiesCheck(_ref) {
  9285. var postType = _ref.postType,
  9286. taxonomies = _ref.taxonomies,
  9287. children = _ref.children;
  9288. var hasTaxonomies = Object(external_lodash_["some"])(taxonomies, function (taxonomy) {
  9289. return Object(external_lodash_["includes"])(taxonomy.types, postType);
  9290. });
  9291. if (!hasTaxonomies) {
  9292. return null;
  9293. }
  9294. return children;
  9295. }
  9296. /* harmony default export */ var post_taxonomies_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  9297. return {
  9298. postType: select('core/editor').getCurrentPostType(),
  9299. taxonomies: select('core').getTaxonomies({
  9300. per_page: -1
  9301. })
  9302. };
  9303. })])(PostTaxonomiesCheck));
  9304. // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
  9305. var lib = __webpack_require__(62);
  9306. var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
  9307. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js
  9308. /**
  9309. * External dependencies
  9310. */
  9311. /**
  9312. * WordPress dependencies
  9313. */
  9314. var post_text_editor_PostTextEditor =
  9315. /*#__PURE__*/
  9316. function (_Component) {
  9317. Object(inherits["a" /* default */])(PostTextEditor, _Component);
  9318. function PostTextEditor() {
  9319. var _this;
  9320. Object(classCallCheck["a" /* default */])(this, PostTextEditor);
  9321. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostTextEditor).apply(this, arguments));
  9322. _this.edit = _this.edit.bind(Object(assertThisInitialized["a" /* default */])(_this));
  9323. _this.stopEditing = _this.stopEditing.bind(Object(assertThisInitialized["a" /* default */])(_this));
  9324. _this.state = {};
  9325. return _this;
  9326. }
  9327. Object(createClass["a" /* default */])(PostTextEditor, [{
  9328. key: "edit",
  9329. /**
  9330. * Handles a textarea change event to notify the onChange prop callback and
  9331. * reflect the new value in the component's own state. This marks the start
  9332. * of the user's edits, if not already changed, preventing future props
  9333. * changes to value from replacing the rendered value. This is expected to
  9334. * be followed by a reset to dirty state via `stopEditing`.
  9335. *
  9336. * @see stopEditing
  9337. *
  9338. * @param {Event} event Change event.
  9339. */
  9340. value: function edit(event) {
  9341. var value = event.target.value;
  9342. this.props.onChange(value);
  9343. this.setState({
  9344. value: value,
  9345. isDirty: true
  9346. });
  9347. }
  9348. /**
  9349. * Function called when the user has completed their edits, responsible for
  9350. * ensuring that changes, if made, are surfaced to the onPersist prop
  9351. * callback and resetting dirty state.
  9352. */
  9353. }, {
  9354. key: "stopEditing",
  9355. value: function stopEditing() {
  9356. if (this.state.isDirty) {
  9357. this.props.onPersist(this.state.value);
  9358. this.setState({
  9359. isDirty: false
  9360. });
  9361. }
  9362. }
  9363. }, {
  9364. key: "render",
  9365. value: function render() {
  9366. var value = this.state.value;
  9367. var instanceId = this.props.instanceId;
  9368. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("label", {
  9369. htmlFor: "post-content-".concat(instanceId),
  9370. className: "screen-reader-text"
  9371. }, Object(external_this_wp_i18n_["__"])('Type text or HTML')), Object(external_this_wp_element_["createElement"])(lib_default.a, {
  9372. autoComplete: "off",
  9373. dir: "auto",
  9374. value: value,
  9375. onChange: this.edit,
  9376. onBlur: this.stopEditing,
  9377. className: "editor-post-text-editor",
  9378. id: "post-content-".concat(instanceId),
  9379. placeholder: Object(external_this_wp_i18n_["__"])('Start writing with text or HTML')
  9380. }));
  9381. }
  9382. }], [{
  9383. key: "getDerivedStateFromProps",
  9384. value: function getDerivedStateFromProps(props, state) {
  9385. if (state.isDirty) {
  9386. return null;
  9387. }
  9388. return {
  9389. value: props.value,
  9390. isDirty: false
  9391. };
  9392. }
  9393. }]);
  9394. return PostTextEditor;
  9395. }(external_this_wp_element_["Component"]);
  9396. /* harmony default export */ var post_text_editor = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  9397. var _select = select('core/editor'),
  9398. getEditedPostContent = _select.getEditedPostContent;
  9399. return {
  9400. value: getEditedPostContent()
  9401. };
  9402. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  9403. var _dispatch = dispatch('core/editor'),
  9404. editPost = _dispatch.editPost,
  9405. resetEditorBlocks = _dispatch.resetEditorBlocks;
  9406. return {
  9407. onChange: function onChange(content) {
  9408. editPost({
  9409. content: content
  9410. });
  9411. },
  9412. onPersist: function onPersist(content) {
  9413. var blocks = Object(external_this_wp_blocks_["parse"])(content);
  9414. resetEditorBlocks(blocks);
  9415. }
  9416. };
  9417. }), external_this_wp_compose_["withInstanceId"]])(post_text_editor_PostTextEditor));
  9418. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-permalink/editor.js
  9419. /**
  9420. * WordPress dependencies
  9421. */
  9422. /**
  9423. * Internal dependencies
  9424. */
  9425. var editor_PostPermalinkEditor =
  9426. /*#__PURE__*/
  9427. function (_Component) {
  9428. Object(inherits["a" /* default */])(PostPermalinkEditor, _Component);
  9429. function PostPermalinkEditor(_ref) {
  9430. var _this;
  9431. var permalinkParts = _ref.permalinkParts,
  9432. slug = _ref.slug;
  9433. Object(classCallCheck["a" /* default */])(this, PostPermalinkEditor);
  9434. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPermalinkEditor).apply(this, arguments));
  9435. _this.state = {
  9436. editedPostName: slug || permalinkParts.postName
  9437. };
  9438. _this.onSavePermalink = _this.onSavePermalink.bind(Object(assertThisInitialized["a" /* default */])(_this));
  9439. return _this;
  9440. }
  9441. Object(createClass["a" /* default */])(PostPermalinkEditor, [{
  9442. key: "onSavePermalink",
  9443. value: function onSavePermalink(event) {
  9444. var postName = cleanForSlug(this.state.editedPostName);
  9445. event.preventDefault();
  9446. this.props.onSave();
  9447. if (postName === this.props.postName) {
  9448. return;
  9449. }
  9450. this.props.editPost({
  9451. slug: postName
  9452. });
  9453. this.setState({
  9454. editedPostName: postName
  9455. });
  9456. }
  9457. }, {
  9458. key: "render",
  9459. value: function render() {
  9460. var _this2 = this;
  9461. var _this$props$permalink = this.props.permalinkParts,
  9462. prefix = _this$props$permalink.prefix,
  9463. suffix = _this$props$permalink.suffix;
  9464. var editedPostName = this.state.editedPostName;
  9465. /* eslint-disable jsx-a11y/no-autofocus */
  9466. // Autofocus is allowed here, as this mini-UI is only loaded when the user clicks to open it.
  9467. return Object(external_this_wp_element_["createElement"])("form", {
  9468. className: "editor-post-permalink-editor",
  9469. onSubmit: this.onSavePermalink
  9470. }, Object(external_this_wp_element_["createElement"])("span", {
  9471. className: "editor-post-permalink__editor-container"
  9472. }, Object(external_this_wp_element_["createElement"])("span", {
  9473. className: "editor-post-permalink-editor__prefix"
  9474. }, prefix), Object(external_this_wp_element_["createElement"])("input", {
  9475. className: "editor-post-permalink-editor__edit",
  9476. "aria-label": Object(external_this_wp_i18n_["__"])('Edit post permalink'),
  9477. value: editedPostName,
  9478. onChange: function onChange(event) {
  9479. return _this2.setState({
  9480. editedPostName: event.target.value
  9481. });
  9482. },
  9483. type: "text",
  9484. autoFocus: true
  9485. }), Object(external_this_wp_element_["createElement"])("span", {
  9486. className: "editor-post-permalink-editor__suffix"
  9487. }, suffix), "\u200E"), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  9488. className: "editor-post-permalink-editor__save",
  9489. isLarge: true,
  9490. onClick: this.onSavePermalink
  9491. }, Object(external_this_wp_i18n_["__"])('Save')));
  9492. /* eslint-enable jsx-a11y/no-autofocus */
  9493. }
  9494. }]);
  9495. return PostPermalinkEditor;
  9496. }(external_this_wp_element_["Component"]);
  9497. /* harmony default export */ var editor = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  9498. var _select = select('core/editor'),
  9499. getPermalinkParts = _select.getPermalinkParts;
  9500. return {
  9501. permalinkParts: getPermalinkParts()
  9502. };
  9503. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  9504. var _dispatch = dispatch('core/editor'),
  9505. editPost = _dispatch.editPost;
  9506. return {
  9507. editPost: editPost
  9508. };
  9509. })])(editor_PostPermalinkEditor));
  9510. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-permalink/index.js
  9511. /**
  9512. * External dependencies
  9513. */
  9514. /**
  9515. * WordPress dependencies
  9516. */
  9517. /**
  9518. * Internal dependencies
  9519. */
  9520. var post_permalink_PostPermalink =
  9521. /*#__PURE__*/
  9522. function (_Component) {
  9523. Object(inherits["a" /* default */])(PostPermalink, _Component);
  9524. function PostPermalink() {
  9525. var _this;
  9526. Object(classCallCheck["a" /* default */])(this, PostPermalink);
  9527. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPermalink).apply(this, arguments));
  9528. _this.addVisibilityCheck = _this.addVisibilityCheck.bind(Object(assertThisInitialized["a" /* default */])(_this));
  9529. _this.onVisibilityChange = _this.onVisibilityChange.bind(Object(assertThisInitialized["a" /* default */])(_this));
  9530. _this.state = {
  9531. isCopied: false,
  9532. isEditingPermalink: false
  9533. };
  9534. return _this;
  9535. }
  9536. Object(createClass["a" /* default */])(PostPermalink, [{
  9537. key: "addVisibilityCheck",
  9538. value: function addVisibilityCheck() {
  9539. window.addEventListener('visibilitychange', this.onVisibilityChange);
  9540. }
  9541. }, {
  9542. key: "onVisibilityChange",
  9543. value: function onVisibilityChange() {
  9544. var _this$props = this.props,
  9545. isEditable = _this$props.isEditable,
  9546. refreshPost = _this$props.refreshPost; // If the user just returned after having clicked the "Change Permalinks" button,
  9547. // fetch a new copy of the post from the server, just in case they enabled permalinks.
  9548. if (!isEditable && 'visible' === document.visibilityState) {
  9549. refreshPost();
  9550. }
  9551. }
  9552. }, {
  9553. key: "componentDidUpdate",
  9554. value: function componentDidUpdate(prevProps, prevState) {
  9555. // If we've just stopped editing the permalink, focus on the new permalink.
  9556. if (prevState.isEditingPermalink && !this.state.isEditingPermalink) {
  9557. this.linkElement.focus();
  9558. }
  9559. }
  9560. }, {
  9561. key: "componentWillUnmount",
  9562. value: function componentWillUnmount() {
  9563. window.removeEventListener('visibilitychange', this.addVisibilityCheck);
  9564. }
  9565. }, {
  9566. key: "render",
  9567. value: function render() {
  9568. var _this2 = this;
  9569. var _this$props2 = this.props,
  9570. isEditable = _this$props2.isEditable,
  9571. isNew = _this$props2.isNew,
  9572. isPublished = _this$props2.isPublished,
  9573. isViewable = _this$props2.isViewable,
  9574. permalinkParts = _this$props2.permalinkParts,
  9575. postLink = _this$props2.postLink,
  9576. postSlug = _this$props2.postSlug,
  9577. postID = _this$props2.postID,
  9578. postTitle = _this$props2.postTitle;
  9579. if (isNew || !isViewable || !permalinkParts || !postLink) {
  9580. return null;
  9581. }
  9582. var _this$state = this.state,
  9583. isCopied = _this$state.isCopied,
  9584. isEditingPermalink = _this$state.isEditingPermalink;
  9585. var ariaLabel = isCopied ? Object(external_this_wp_i18n_["__"])('Permalink copied') : Object(external_this_wp_i18n_["__"])('Copy the permalink');
  9586. var prefix = permalinkParts.prefix,
  9587. suffix = permalinkParts.suffix;
  9588. var slug = Object(external_this_wp_url_["safeDecodeURIComponent"])(postSlug) || cleanForSlug(postTitle) || postID;
  9589. var samplePermalink = isEditable ? prefix + slug + suffix : prefix;
  9590. return Object(external_this_wp_element_["createElement"])("div", {
  9591. className: "editor-post-permalink"
  9592. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], {
  9593. className: classnames_default()('editor-post-permalink__copy', {
  9594. 'is-copied': isCopied
  9595. }),
  9596. text: samplePermalink,
  9597. label: ariaLabel,
  9598. onCopy: function onCopy() {
  9599. return _this2.setState({
  9600. isCopied: true
  9601. });
  9602. },
  9603. "aria-disabled": isCopied,
  9604. icon: "admin-links"
  9605. }), Object(external_this_wp_element_["createElement"])("span", {
  9606. className: "editor-post-permalink__label"
  9607. }, Object(external_this_wp_i18n_["__"])('Permalink:')), !isEditingPermalink && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], {
  9608. className: "editor-post-permalink__link",
  9609. href: !isPublished ? postLink : samplePermalink,
  9610. target: "_blank",
  9611. ref: function ref(linkElement) {
  9612. return _this2.linkElement = linkElement;
  9613. }
  9614. }, Object(external_this_wp_url_["safeDecodeURI"])(samplePermalink), "\u200E"), isEditingPermalink && Object(external_this_wp_element_["createElement"])(editor, {
  9615. slug: slug,
  9616. onSave: function onSave() {
  9617. return _this2.setState({
  9618. isEditingPermalink: false
  9619. });
  9620. }
  9621. }), isEditable && !isEditingPermalink && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  9622. className: "editor-post-permalink__edit",
  9623. isLarge: true,
  9624. onClick: function onClick() {
  9625. return _this2.setState({
  9626. isEditingPermalink: true
  9627. });
  9628. }
  9629. }, Object(external_this_wp_i18n_["__"])('Edit')));
  9630. }
  9631. }]);
  9632. return PostPermalink;
  9633. }(external_this_wp_element_["Component"]);
  9634. /* harmony default export */ var post_permalink = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  9635. var _select = select('core/editor'),
  9636. isEditedPostNew = _select.isEditedPostNew,
  9637. isPermalinkEditable = _select.isPermalinkEditable,
  9638. getCurrentPost = _select.getCurrentPost,
  9639. getPermalinkParts = _select.getPermalinkParts,
  9640. getEditedPostAttribute = _select.getEditedPostAttribute,
  9641. isCurrentPostPublished = _select.isCurrentPostPublished;
  9642. var _select2 = select('core'),
  9643. getPostType = _select2.getPostType;
  9644. var _getCurrentPost = getCurrentPost(),
  9645. id = _getCurrentPost.id,
  9646. link = _getCurrentPost.link;
  9647. var postTypeName = getEditedPostAttribute('type');
  9648. var postType = getPostType(postTypeName);
  9649. return {
  9650. isNew: isEditedPostNew(),
  9651. postLink: link,
  9652. permalinkParts: getPermalinkParts(),
  9653. postSlug: getEditedPostAttribute('slug'),
  9654. isEditable: isPermalinkEditable(),
  9655. isPublished: isCurrentPostPublished(),
  9656. postTitle: getEditedPostAttribute('title'),
  9657. postID: id,
  9658. isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false)
  9659. };
  9660. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  9661. var _dispatch = dispatch('core/editor'),
  9662. refreshPost = _dispatch.refreshPost;
  9663. return {
  9664. refreshPost: refreshPost
  9665. };
  9666. })])(post_permalink_PostPermalink));
  9667. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js
  9668. /**
  9669. * External dependencies
  9670. */
  9671. /**
  9672. * WordPress dependencies
  9673. */
  9674. /**
  9675. * Internal dependencies
  9676. */
  9677. /**
  9678. * Constants
  9679. */
  9680. var REGEXP_NEWLINES = /[\r\n]+/g;
  9681. var post_title_PostTitle =
  9682. /*#__PURE__*/
  9683. function (_Component) {
  9684. Object(inherits["a" /* default */])(PostTitle, _Component);
  9685. function PostTitle() {
  9686. var _this;
  9687. Object(classCallCheck["a" /* default */])(this, PostTitle);
  9688. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostTitle).apply(this, arguments));
  9689. _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this));
  9690. _this.onSelect = _this.onSelect.bind(Object(assertThisInitialized["a" /* default */])(_this));
  9691. _this.onUnselect = _this.onUnselect.bind(Object(assertThisInitialized["a" /* default */])(_this));
  9692. _this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(_this));
  9693. _this.redirectHistory = _this.redirectHistory.bind(Object(assertThisInitialized["a" /* default */])(_this));
  9694. _this.state = {
  9695. isSelected: false
  9696. };
  9697. return _this;
  9698. }
  9699. Object(createClass["a" /* default */])(PostTitle, [{
  9700. key: "handleFocusOutside",
  9701. value: function handleFocusOutside() {
  9702. this.onUnselect();
  9703. }
  9704. }, {
  9705. key: "onSelect",
  9706. value: function onSelect() {
  9707. this.setState({
  9708. isSelected: true
  9709. });
  9710. this.props.clearSelectedBlock();
  9711. }
  9712. }, {
  9713. key: "onUnselect",
  9714. value: function onUnselect() {
  9715. this.setState({
  9716. isSelected: false
  9717. });
  9718. }
  9719. }, {
  9720. key: "onChange",
  9721. value: function onChange(event) {
  9722. var newTitle = event.target.value.replace(REGEXP_NEWLINES, ' ');
  9723. this.props.onUpdate(newTitle);
  9724. }
  9725. }, {
  9726. key: "onKeyDown",
  9727. value: function onKeyDown(event) {
  9728. if (event.keyCode === external_this_wp_keycodes_["ENTER"]) {
  9729. event.preventDefault();
  9730. this.props.onEnterPress();
  9731. }
  9732. }
  9733. /**
  9734. * Emulates behavior of an undo or redo on its corresponding key press
  9735. * combination. This is a workaround to React's treatment of undo in a
  9736. * controlled textarea where characters are updated one at a time.
  9737. * Instead, leverage the store's undo handling of title changes.
  9738. *
  9739. * @see https://github.com/facebook/react/issues/8514
  9740. *
  9741. * @param {KeyboardEvent} event Key event.
  9742. */
  9743. }, {
  9744. key: "redirectHistory",
  9745. value: function redirectHistory(event) {
  9746. if (event.shiftKey) {
  9747. this.props.onRedo();
  9748. } else {
  9749. this.props.onUndo();
  9750. }
  9751. event.preventDefault();
  9752. }
  9753. }, {
  9754. key: "render",
  9755. value: function render() {
  9756. var _this$props = this.props,
  9757. hasFixedToolbar = _this$props.hasFixedToolbar,
  9758. isCleanNewPost = _this$props.isCleanNewPost,
  9759. isFocusMode = _this$props.isFocusMode,
  9760. isPostTypeViewable = _this$props.isPostTypeViewable,
  9761. instanceId = _this$props.instanceId,
  9762. placeholder = _this$props.placeholder,
  9763. title = _this$props.title;
  9764. var isSelected = this.state.isSelected; // The wp-block className is important for editor styles.
  9765. var className = classnames_default()('wp-block editor-post-title__block', {
  9766. 'is-selected': isSelected,
  9767. 'is-focus-mode': isFocusMode,
  9768. 'has-fixed-toolbar': hasFixedToolbar
  9769. });
  9770. var decodedPlaceholder = Object(external_this_wp_htmlEntities_["decodeEntities"])(placeholder);
  9771. return Object(external_this_wp_element_["createElement"])(post_type_support_check, {
  9772. supportKeys: "title"
  9773. }, Object(external_this_wp_element_["createElement"])("div", {
  9774. className: "editor-post-title"
  9775. }, Object(external_this_wp_element_["createElement"])("div", {
  9776. className: className
  9777. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], {
  9778. shortcuts: {
  9779. 'mod+z': this.redirectHistory,
  9780. 'mod+shift+z': this.redirectHistory
  9781. }
  9782. }, Object(external_this_wp_element_["createElement"])("label", {
  9783. htmlFor: "post-title-".concat(instanceId),
  9784. className: "screen-reader-text"
  9785. }, decodedPlaceholder || Object(external_this_wp_i18n_["__"])('Add title')), Object(external_this_wp_element_["createElement"])(lib_default.a, {
  9786. id: "post-title-".concat(instanceId),
  9787. className: "editor-post-title__input",
  9788. value: title,
  9789. onChange: this.onChange,
  9790. placeholder: decodedPlaceholder || Object(external_this_wp_i18n_["__"])('Add title'),
  9791. onFocus: this.onSelect,
  9792. onKeyDown: this.onKeyDown,
  9793. onKeyPress: this.onUnselect
  9794. /*
  9795. Only autofocus the title when the post is entirely empty.
  9796. This should only happen for a new post, which means we
  9797. focus the title on new post so the author can start typing
  9798. right away, without needing to click anything.
  9799. */
  9800. /* eslint-disable jsx-a11y/no-autofocus */
  9801. ,
  9802. autoFocus: document.body === document.activeElement && isCleanNewPost
  9803. /* eslint-enable jsx-a11y/no-autofocus */
  9804. })), isSelected && isPostTypeViewable && Object(external_this_wp_element_["createElement"])(post_permalink, null))));
  9805. }
  9806. }]);
  9807. return PostTitle;
  9808. }(external_this_wp_element_["Component"]);
  9809. var post_title_applyWithSelect = Object(external_this_wp_data_["withSelect"])(function (select) {
  9810. var _select = select('core/editor'),
  9811. getEditedPostAttribute = _select.getEditedPostAttribute,
  9812. isCleanNewPost = _select.isCleanNewPost;
  9813. var _select2 = select('core/block-editor'),
  9814. getSettings = _select2.getSettings;
  9815. var _select3 = select('core'),
  9816. getPostType = _select3.getPostType;
  9817. var postType = getPostType(getEditedPostAttribute('type'));
  9818. var _getSettings = getSettings(),
  9819. titlePlaceholder = _getSettings.titlePlaceholder,
  9820. focusMode = _getSettings.focusMode,
  9821. hasFixedToolbar = _getSettings.hasFixedToolbar;
  9822. return {
  9823. isCleanNewPost: isCleanNewPost(),
  9824. title: getEditedPostAttribute('title'),
  9825. isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false),
  9826. placeholder: titlePlaceholder,
  9827. isFocusMode: focusMode,
  9828. hasFixedToolbar: hasFixedToolbar
  9829. };
  9830. });
  9831. var post_title_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  9832. var _dispatch = dispatch('core/block-editor'),
  9833. insertDefaultBlock = _dispatch.insertDefaultBlock,
  9834. clearSelectedBlock = _dispatch.clearSelectedBlock;
  9835. var _dispatch2 = dispatch('core/editor'),
  9836. editPost = _dispatch2.editPost,
  9837. undo = _dispatch2.undo,
  9838. redo = _dispatch2.redo;
  9839. return {
  9840. onEnterPress: function onEnterPress() {
  9841. insertDefaultBlock(undefined, undefined, 0);
  9842. },
  9843. onUpdate: function onUpdate(title) {
  9844. editPost({
  9845. title: title
  9846. });
  9847. },
  9848. onUndo: undo,
  9849. onRedo: redo,
  9850. clearSelectedBlock: clearSelectedBlock
  9851. };
  9852. });
  9853. /* harmony default export */ var post_title = (Object(external_this_wp_compose_["compose"])(post_title_applyWithSelect, post_title_applyWithDispatch, external_this_wp_compose_["withInstanceId"], external_this_wp_components_["withFocusOutside"])(post_title_PostTitle));
  9854. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js
  9855. /**
  9856. * WordPress dependencies
  9857. */
  9858. function PostTrash(_ref) {
  9859. var isNew = _ref.isNew,
  9860. postId = _ref.postId,
  9861. postType = _ref.postType,
  9862. props = Object(objectWithoutProperties["a" /* default */])(_ref, ["isNew", "postId", "postType"]);
  9863. if (isNew || !postId) {
  9864. return null;
  9865. }
  9866. var onClick = function onClick() {
  9867. return props.trashPost(postId, postType);
  9868. };
  9869. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  9870. className: "editor-post-trash button-link-delete",
  9871. onClick: onClick,
  9872. isDefault: true,
  9873. isLarge: true
  9874. }, Object(external_this_wp_i18n_["__"])('Move to Trash'));
  9875. }
  9876. /* harmony default export */ var post_trash = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  9877. var _select = select('core/editor'),
  9878. isEditedPostNew = _select.isEditedPostNew,
  9879. getCurrentPostId = _select.getCurrentPostId,
  9880. getCurrentPostType = _select.getCurrentPostType;
  9881. return {
  9882. isNew: isEditedPostNew(),
  9883. postId: getCurrentPostId(),
  9884. postType: getCurrentPostType()
  9885. };
  9886. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  9887. return {
  9888. trashPost: dispatch('core/editor').trashPost
  9889. };
  9890. })])(PostTrash));
  9891. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js
  9892. /**
  9893. * WordPress dependencies
  9894. */
  9895. function PostTrashCheck(_ref) {
  9896. var isNew = _ref.isNew,
  9897. postId = _ref.postId,
  9898. children = _ref.children;
  9899. if (isNew || !postId) {
  9900. return null;
  9901. }
  9902. return children;
  9903. }
  9904. /* harmony default export */ var post_trash_check = (Object(external_this_wp_data_["withSelect"])(function (select) {
  9905. var _select = select('core/editor'),
  9906. isEditedPostNew = _select.isEditedPostNew,
  9907. getCurrentPostId = _select.getCurrentPostId;
  9908. return {
  9909. isNew: isEditedPostNew(),
  9910. postId: getCurrentPostId()
  9911. };
  9912. })(PostTrashCheck));
  9913. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js
  9914. /**
  9915. * External dependencies
  9916. */
  9917. /**
  9918. * WordPress dependencies
  9919. */
  9920. function PostVisibilityCheck(_ref) {
  9921. var hasPublishAction = _ref.hasPublishAction,
  9922. render = _ref.render;
  9923. var canEdit = hasPublishAction;
  9924. return render({
  9925. canEdit: canEdit
  9926. });
  9927. }
  9928. /* harmony default export */ var post_visibility_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
  9929. var _select = select('core/editor'),
  9930. getCurrentPost = _select.getCurrentPost,
  9931. getCurrentPostType = _select.getCurrentPostType;
  9932. return {
  9933. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  9934. postType: getCurrentPostType()
  9935. };
  9936. })])(PostVisibilityCheck));
  9937. // EXTERNAL MODULE: external {"this":["wp","wordcount"]}
  9938. var external_this_wp_wordcount_ = __webpack_require__(97);
  9939. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js
  9940. /**
  9941. * WordPress dependencies
  9942. */
  9943. function WordCount(_ref) {
  9944. var content = _ref.content;
  9945. /*
  9946. * translators: If your word count is based on single characters (e.g. East Asian characters),
  9947. * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
  9948. * Do not translate into your own language.
  9949. */
  9950. var wordCountType = Object(external_this_wp_i18n_["_x"])('words', 'Word count type. Do not translate!');
  9951. return Object(external_this_wp_element_["createElement"])("span", {
  9952. className: "word-count"
  9953. }, Object(external_this_wp_wordcount_["count"])(content, wordCountType));
  9954. }
  9955. /* harmony default export */ var word_count = (Object(external_this_wp_data_["withSelect"])(function (select) {
  9956. return {
  9957. content: select('core/editor').getEditedPostAttribute('content')
  9958. };
  9959. })(WordCount));
  9960. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js
  9961. /**
  9962. * WordPress dependencies
  9963. */
  9964. /**
  9965. * Internal dependencies
  9966. */
  9967. function TableOfContentsPanel(_ref) {
  9968. var headingCount = _ref.headingCount,
  9969. paragraphCount = _ref.paragraphCount,
  9970. numberOfBlocks = _ref.numberOfBlocks,
  9971. hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled,
  9972. onRequestClose = _ref.onRequestClose;
  9973. return (
  9974. /*
  9975. * Disable reason: The `list` ARIA role is redundant but
  9976. * Safari+VoiceOver won't announce the list otherwise.
  9977. */
  9978. /* eslint-disable jsx-a11y/no-redundant-roles */
  9979. Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("div", {
  9980. className: "table-of-contents__wrapper",
  9981. role: "note",
  9982. "aria-label": Object(external_this_wp_i18n_["__"])('Document Statistics'),
  9983. tabIndex: "0"
  9984. }, Object(external_this_wp_element_["createElement"])("ul", {
  9985. role: "list",
  9986. className: "table-of-contents__counts"
  9987. }, Object(external_this_wp_element_["createElement"])("li", {
  9988. className: "table-of-contents__count"
  9989. }, Object(external_this_wp_i18n_["__"])('Words'), Object(external_this_wp_element_["createElement"])(word_count, null)), Object(external_this_wp_element_["createElement"])("li", {
  9990. className: "table-of-contents__count"
  9991. }, Object(external_this_wp_i18n_["__"])('Headings'), Object(external_this_wp_element_["createElement"])("span", {
  9992. className: "table-of-contents__number"
  9993. }, headingCount)), Object(external_this_wp_element_["createElement"])("li", {
  9994. className: "table-of-contents__count"
  9995. }, Object(external_this_wp_i18n_["__"])('Paragraphs'), Object(external_this_wp_element_["createElement"])("span", {
  9996. className: "table-of-contents__number"
  9997. }, paragraphCount)), Object(external_this_wp_element_["createElement"])("li", {
  9998. className: "table-of-contents__count"
  9999. }, Object(external_this_wp_i18n_["__"])('Blocks'), Object(external_this_wp_element_["createElement"])("span", {
  10000. className: "table-of-contents__number"
  10001. }, numberOfBlocks)))), headingCount > 0 && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("hr", null), Object(external_this_wp_element_["createElement"])("h2", {
  10002. className: "table-of-contents__title"
  10003. }, Object(external_this_wp_i18n_["__"])('Document Outline')), Object(external_this_wp_element_["createElement"])(document_outline, {
  10004. onSelect: onRequestClose,
  10005. hasOutlineItemsDisabled: hasOutlineItemsDisabled
  10006. })))
  10007. /* eslint-enable jsx-a11y/no-redundant-roles */
  10008. );
  10009. }
  10010. /* harmony default export */ var panel = (Object(external_this_wp_data_["withSelect"])(function (select) {
  10011. var _select = select('core/block-editor'),
  10012. getGlobalBlockCount = _select.getGlobalBlockCount;
  10013. return {
  10014. headingCount: getGlobalBlockCount('core/heading'),
  10015. paragraphCount: getGlobalBlockCount('core/paragraph'),
  10016. numberOfBlocks: getGlobalBlockCount()
  10017. };
  10018. })(TableOfContentsPanel));
  10019. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js
  10020. /**
  10021. * WordPress dependencies
  10022. */
  10023. /**
  10024. * Internal dependencies
  10025. */
  10026. function TableOfContents(_ref) {
  10027. var hasBlocks = _ref.hasBlocks,
  10028. hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled;
  10029. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], {
  10030. position: "bottom",
  10031. className: "table-of-contents",
  10032. contentClassName: "table-of-contents__popover",
  10033. renderToggle: function renderToggle(_ref2) {
  10034. var isOpen = _ref2.isOpen,
  10035. onToggle = _ref2.onToggle;
  10036. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], {
  10037. onClick: hasBlocks ? onToggle : undefined,
  10038. icon: "info-outline",
  10039. "aria-expanded": isOpen,
  10040. label: Object(external_this_wp_i18n_["__"])('Content structure'),
  10041. labelPosition: "bottom",
  10042. "aria-disabled": !hasBlocks
  10043. });
  10044. },
  10045. renderContent: function renderContent(_ref3) {
  10046. var onClose = _ref3.onClose;
  10047. return Object(external_this_wp_element_["createElement"])(panel, {
  10048. onRequestClose: onClose,
  10049. hasOutlineItemsDisabled: hasOutlineItemsDisabled
  10050. });
  10051. }
  10052. });
  10053. }
  10054. /* harmony default export */ var table_of_contents = (Object(external_this_wp_data_["withSelect"])(function (select) {
  10055. return {
  10056. hasBlocks: !!select('core/block-editor').getBlockCount()
  10057. };
  10058. })(TableOfContents));
  10059. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js
  10060. /**
  10061. * WordPress dependencies
  10062. */
  10063. var unsaved_changes_warning_UnsavedChangesWarning =
  10064. /*#__PURE__*/
  10065. function (_Component) {
  10066. Object(inherits["a" /* default */])(UnsavedChangesWarning, _Component);
  10067. function UnsavedChangesWarning() {
  10068. var _this;
  10069. Object(classCallCheck["a" /* default */])(this, UnsavedChangesWarning);
  10070. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(UnsavedChangesWarning).apply(this, arguments));
  10071. _this.warnIfUnsavedChanges = _this.warnIfUnsavedChanges.bind(Object(assertThisInitialized["a" /* default */])(_this));
  10072. return _this;
  10073. }
  10074. Object(createClass["a" /* default */])(UnsavedChangesWarning, [{
  10075. key: "componentDidMount",
  10076. value: function componentDidMount() {
  10077. window.addEventListener('beforeunload', this.warnIfUnsavedChanges);
  10078. }
  10079. }, {
  10080. key: "componentWillUnmount",
  10081. value: function componentWillUnmount() {
  10082. window.removeEventListener('beforeunload', this.warnIfUnsavedChanges);
  10083. }
  10084. /**
  10085. * Warns the user if there are unsaved changes before leaving the editor.
  10086. *
  10087. * @param {Event} event `beforeunload` event.
  10088. *
  10089. * @return {?string} Warning prompt message, if unsaved changes exist.
  10090. */
  10091. }, {
  10092. key: "warnIfUnsavedChanges",
  10093. value: function warnIfUnsavedChanges(event) {
  10094. var isEditedPostDirty = this.props.isEditedPostDirty;
  10095. if (isEditedPostDirty()) {
  10096. event.returnValue = Object(external_this_wp_i18n_["__"])('You have unsaved changes. If you proceed, they will be lost.');
  10097. return event.returnValue;
  10098. }
  10099. }
  10100. }, {
  10101. key: "render",
  10102. value: function render() {
  10103. return null;
  10104. }
  10105. }]);
  10106. return UnsavedChangesWarning;
  10107. }(external_this_wp_element_["Component"]);
  10108. /* harmony default export */ var unsaved_changes_warning = (Object(external_this_wp_data_["withSelect"])(function (select) {
  10109. return {
  10110. // We need to call the selector directly in the listener to avoid race
  10111. // conditions with `BrowserURL` where `componentDidUpdate` gets the
  10112. // new value of `isEditedPostDirty` before this component does,
  10113. // causing this component to incorrectly think a trashed post is still dirty.
  10114. isEditedPostDirty: select('core/editor').isEditedPostDirty
  10115. };
  10116. })(unsaved_changes_warning_UnsavedChangesWarning));
  10117. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js
  10118. /**
  10119. * WordPress dependencies
  10120. */
  10121. /**
  10122. * Internal dependencies
  10123. */
  10124. var withRegistryProvider = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (WrappedComponent) {
  10125. return Object(external_this_wp_data_["withRegistry"])(function (props) {
  10126. var _props$useSubRegistry = props.useSubRegistry,
  10127. useSubRegistry = _props$useSubRegistry === void 0 ? true : _props$useSubRegistry,
  10128. registry = props.registry,
  10129. additionalProps = Object(objectWithoutProperties["a" /* default */])(props, ["useSubRegistry", "registry"]);
  10130. if (!useSubRegistry) {
  10131. return Object(external_this_wp_element_["createElement"])(WrappedComponent, additionalProps);
  10132. }
  10133. var _useState = Object(external_this_wp_element_["useState"])(null),
  10134. _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
  10135. subRegistry = _useState2[0],
  10136. setSubRegistry = _useState2[1];
  10137. Object(external_this_wp_element_["useEffect"])(function () {
  10138. var newRegistry = Object(external_this_wp_data_["createRegistry"])({
  10139. 'core/block-editor': external_this_wp_blockEditor_["storeConfig"]
  10140. }, registry);
  10141. var store = newRegistry.registerStore('core/editor', storeConfig); // This should be removed after the refactoring of the effects to controls.
  10142. middlewares(store);
  10143. setSubRegistry(newRegistry);
  10144. }, [registry]);
  10145. if (!subRegistry) {
  10146. return null;
  10147. }
  10148. return Object(external_this_wp_element_["createElement"])(external_this_wp_data_["RegistryProvider"], {
  10149. value: subRegistry
  10150. }, Object(external_this_wp_element_["createElement"])(WrappedComponent, additionalProps));
  10151. });
  10152. }, 'withRegistryProvider');
  10153. /* harmony default export */ var with_registry_provider = (withRegistryProvider);
  10154. // EXTERNAL MODULE: external {"this":["wp","mediaUtils"]}
  10155. var external_this_wp_mediaUtils_ = __webpack_require__(99);
  10156. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js
  10157. /**
  10158. * External dependencies
  10159. */
  10160. /**
  10161. * WordPress dependencies
  10162. */
  10163. /**
  10164. * Upload a media file when the file upload button is activated.
  10165. * Wrapper around mediaUpload() that injects the current post ID.
  10166. *
  10167. * @param {Object} $0 Parameters object passed to the function.
  10168. * @param {?Object} $0.additionalData Additional data to include in the request.
  10169. * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.
  10170. * @param {Array} $0.filesList List of files.
  10171. * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.
  10172. * @param {Function} $0.onError Function called when an error happens.
  10173. * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.
  10174. */
  10175. /* harmony default export */ var media_upload = (function (_ref) {
  10176. var _ref$additionalData = _ref.additionalData,
  10177. additionalData = _ref$additionalData === void 0 ? {} : _ref$additionalData,
  10178. allowedTypes = _ref.allowedTypes,
  10179. filesList = _ref.filesList,
  10180. maxUploadFileSize = _ref.maxUploadFileSize,
  10181. _ref$onError = _ref.onError,
  10182. _onError = _ref$onError === void 0 ? external_lodash_["noop"] : _ref$onError,
  10183. onFileChange = _ref.onFileChange;
  10184. var _select = Object(external_this_wp_data_["select"])('core/editor'),
  10185. getCurrentPostId = _select.getCurrentPostId,
  10186. getEditorSettings = _select.getEditorSettings;
  10187. var wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;
  10188. maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize;
  10189. Object(external_this_wp_mediaUtils_["uploadMedia"])({
  10190. allowedTypes: allowedTypes,
  10191. filesList: filesList,
  10192. onFileChange: onFileChange,
  10193. additionalData: Object(objectSpread["a" /* default */])({
  10194. post: getCurrentPostId()
  10195. }, additionalData),
  10196. maxUploadFileSize: maxUploadFileSize,
  10197. onError: function onError(_ref2) {
  10198. var message = _ref2.message;
  10199. return _onError(message);
  10200. },
  10201. wpAllowedMimeTypes: wpAllowedMimeTypes
  10202. });
  10203. });
  10204. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js
  10205. /**
  10206. * Internal dependencies
  10207. */
  10208. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/reusable-blocks-buttons/reusable-block-convert-button.js
  10209. /**
  10210. * External dependencies
  10211. */
  10212. /**
  10213. * WordPress dependencies
  10214. */
  10215. function ReusableBlockConvertButton(_ref) {
  10216. var isVisible = _ref.isVisible,
  10217. isReusable = _ref.isReusable,
  10218. onConvertToStatic = _ref.onConvertToStatic,
  10219. onConvertToReusable = _ref.onConvertToReusable;
  10220. if (!isVisible) {
  10221. return null;
  10222. }
  10223. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, !isReusable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], {
  10224. className: "editor-block-settings-menu__control block-editor-block-settings-menu__control",
  10225. icon: "controls-repeat",
  10226. onClick: onConvertToReusable
  10227. }, Object(external_this_wp_i18n_["__"])('Add to Reusable Blocks')), isReusable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], {
  10228. className: "editor-block-settings-menu__control block-editor-block-settings-menu__control",
  10229. icon: "controls-repeat",
  10230. onClick: onConvertToStatic
  10231. }, Object(external_this_wp_i18n_["__"])('Convert to Regular Block')));
  10232. }
  10233. /* harmony default export */ var reusable_block_convert_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) {
  10234. var clientIds = _ref2.clientIds;
  10235. var _select = select('core/block-editor'),
  10236. getBlocksByClientId = _select.getBlocksByClientId,
  10237. canInsertBlockType = _select.canInsertBlockType;
  10238. var _select2 = select('core/editor'),
  10239. getReusableBlock = _select2.__experimentalGetReusableBlock;
  10240. var _select3 = select('core'),
  10241. canUser = _select3.canUser;
  10242. var blocks = getBlocksByClientId(clientIds);
  10243. var isReusable = blocks.length === 1 && blocks[0] && Object(external_this_wp_blocks_["isReusableBlock"])(blocks[0]) && !!getReusableBlock(blocks[0].attributes.ref); // Show 'Convert to Regular Block' when selected block is a reusable block
  10244. var isVisible = isReusable || // Hide 'Add to Reusable Blocks' when reusable blocks are disabled
  10245. canInsertBlockType('core/block') && Object(external_lodash_["every"])(blocks, function (block) {
  10246. return (// Guard against the case where a regular block has *just* been converted
  10247. !!block && // Hide 'Add to Reusable Blocks' on invalid blocks
  10248. block.isValid && // Hide 'Add to Reusable Blocks' when block doesn't support being made reusable
  10249. Object(external_this_wp_blocks_["hasBlockSupport"])(block.name, 'reusable', true)
  10250. );
  10251. }) && // Hide 'Add to Reusable Blocks' when current doesn't have permission to do that
  10252. !!canUser('create', 'blocks');
  10253. return {
  10254. isReusable: isReusable,
  10255. isVisible: isVisible
  10256. };
  10257. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3) {
  10258. var clientIds = _ref3.clientIds,
  10259. _ref3$onToggle = _ref3.onToggle,
  10260. onToggle = _ref3$onToggle === void 0 ? external_lodash_["noop"] : _ref3$onToggle;
  10261. var _dispatch = dispatch('core/editor'),
  10262. convertBlockToReusable = _dispatch.__experimentalConvertBlockToReusable,
  10263. convertBlockToStatic = _dispatch.__experimentalConvertBlockToStatic;
  10264. return {
  10265. onConvertToStatic: function onConvertToStatic() {
  10266. if (clientIds.length !== 1) {
  10267. return;
  10268. }
  10269. convertBlockToStatic(clientIds[0]);
  10270. onToggle();
  10271. },
  10272. onConvertToReusable: function onConvertToReusable() {
  10273. convertBlockToReusable(clientIds);
  10274. onToggle();
  10275. }
  10276. };
  10277. })])(ReusableBlockConvertButton));
  10278. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/reusable-blocks-buttons/reusable-block-delete-button.js
  10279. /**
  10280. * External dependencies
  10281. */
  10282. /**
  10283. * WordPress dependencies
  10284. */
  10285. function ReusableBlockDeleteButton(_ref) {
  10286. var isVisible = _ref.isVisible,
  10287. isDisabled = _ref.isDisabled,
  10288. onDelete = _ref.onDelete;
  10289. if (!isVisible) {
  10290. return null;
  10291. }
  10292. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], {
  10293. className: "editor-block-settings-menu__control block-editor-block-settings-menu__control",
  10294. icon: "no",
  10295. disabled: isDisabled,
  10296. onClick: function onClick() {
  10297. return onDelete();
  10298. }
  10299. }, Object(external_this_wp_i18n_["__"])('Remove from Reusable Blocks'));
  10300. }
  10301. /* harmony default export */ var reusable_block_delete_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) {
  10302. var clientId = _ref2.clientId;
  10303. var _select = select('core/block-editor'),
  10304. getBlock = _select.getBlock;
  10305. var _select2 = select('core'),
  10306. canUser = _select2.canUser;
  10307. var _select3 = select('core/editor'),
  10308. getReusableBlock = _select3.__experimentalGetReusableBlock;
  10309. var block = getBlock(clientId);
  10310. var reusableBlock = block && Object(external_this_wp_blocks_["isReusableBlock"])(block) ? getReusableBlock(block.attributes.ref) : null;
  10311. return {
  10312. isVisible: !!reusableBlock && !!canUser('delete', 'blocks', reusableBlock.id),
  10313. isDisabled: reusableBlock && reusableBlock.isTemporary
  10314. };
  10315. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3, _ref4) {
  10316. var clientId = _ref3.clientId,
  10317. _ref3$onToggle = _ref3.onToggle,
  10318. onToggle = _ref3$onToggle === void 0 ? external_lodash_["noop"] : _ref3$onToggle;
  10319. var select = _ref4.select;
  10320. var _dispatch = dispatch('core/editor'),
  10321. deleteReusableBlock = _dispatch.__experimentalDeleteReusableBlock;
  10322. var _select4 = select('core/block-editor'),
  10323. getBlock = _select4.getBlock;
  10324. return {
  10325. onDelete: function onDelete() {
  10326. // TODO: Make this a <Confirm /> component or similar
  10327. // eslint-disable-next-line no-alert
  10328. var hasConfirmed = window.confirm(Object(external_this_wp_i18n_["__"])('Are you sure you want to delete this Reusable Block?\n\n' + 'It will be permanently removed from all posts and pages that use it.'));
  10329. if (hasConfirmed) {
  10330. var block = getBlock(clientId);
  10331. deleteReusableBlock(block.attributes.ref);
  10332. onToggle();
  10333. }
  10334. }
  10335. };
  10336. })])(ReusableBlockDeleteButton));
  10337. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/reusable-blocks-buttons/index.js
  10338. /**
  10339. * WordPress dependencies
  10340. */
  10341. /**
  10342. * Internal dependencies
  10343. */
  10344. function ReusableBlocksButtons(_ref) {
  10345. var clientIds = _ref.clientIds;
  10346. return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlockSettingsMenuPluginsExtension"], null, function (_ref2) {
  10347. var onClose = _ref2.onClose;
  10348. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(reusable_block_convert_button, {
  10349. clientIds: clientIds,
  10350. onToggle: onClose
  10351. }), clientIds.length === 1 && Object(external_this_wp_element_["createElement"])(reusable_block_delete_button, {
  10352. clientId: clientIds[0],
  10353. onToggle: onClose
  10354. }));
  10355. });
  10356. }
  10357. /* harmony default export */ var reusable_blocks_buttons = (Object(external_this_wp_data_["withSelect"])(function (select) {
  10358. var _select = select('core/block-editor'),
  10359. getSelectedBlockClientIds = _select.getSelectedBlockClientIds;
  10360. return {
  10361. clientIds: getSelectedBlockClientIds()
  10362. };
  10363. })(ReusableBlocksButtons));
  10364. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/convert-to-group-buttons/icons.js
  10365. /**
  10366. * WordPress dependencies
  10367. */
  10368. var GroupSVG = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], {
  10369. width: "20",
  10370. height: "20",
  10371. viewBox: "0 0 20 20",
  10372. xmlns: "http://www.w3.org/2000/svg"
  10373. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], {
  10374. fillRule: "evenodd",
  10375. clipRule: "evenodd",
  10376. d: "M8 5a1 1 0 0 0-1 1v3H6a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-3h1a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H8zm3 6H7v2h4v-2zM9 9V7h4v2H9z"
  10377. }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], {
  10378. fillRule: "evenodd",
  10379. clipRule: "evenodd",
  10380. d: "M1 3a2 2 0 0 0 1 1.732v10.536A2 2 0 1 0 4.732 18h10.536A2 2 0 1 0 18 15.268V4.732A2 2 0 1 0 15.268 2H4.732A2 2 0 0 0 1 3zm14.268 1H4.732A2.01 2.01 0 0 1 4 4.732v10.536c.304.175.557.428.732.732h10.536a2.01 2.01 0 0 1 .732-.732V4.732A2.01 2.01 0 0 1 15.268 4z"
  10381. }));
  10382. var Group = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
  10383. icon: GroupSVG
  10384. });
  10385. var UngroupSVG = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], {
  10386. width: "20",
  10387. height: "20",
  10388. viewBox: "0 0 20 20",
  10389. xmlns: "http://www.w3.org/2000/svg"
  10390. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], {
  10391. fillRule: "evenodd",
  10392. clipRule: "evenodd",
  10393. d: "M9 2H15C16.1 2 17 2.9 17 4V7C17 8.1 16.1 9 15 9H9C7.9 9 7 8.1 7 7V4C7 2.9 7.9 2 9 2ZM9 7H15V4H9V7Z"
  10394. }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], {
  10395. fillRule: "evenodd",
  10396. clipRule: "evenodd",
  10397. d: "M5 11H11C12.1 11 13 11.9 13 13V16C13 17.1 12.1 18 11 18H5C3.9 18 3 17.1 3 16V13C3 11.9 3.9 11 5 11ZM5 16H11V13H5V16Z"
  10398. }));
  10399. var Ungroup = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
  10400. icon: UngroupSVG
  10401. });
  10402. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/convert-to-group-buttons/convert-button.js
  10403. /**
  10404. * External dependencies
  10405. */
  10406. /**
  10407. * WordPress dependencies
  10408. */
  10409. /**
  10410. * Internal dependencies
  10411. */
  10412. function ConvertToGroupButton(_ref) {
  10413. var onConvertToGroup = _ref.onConvertToGroup,
  10414. onConvertFromGroup = _ref.onConvertFromGroup,
  10415. _ref$isGroupable = _ref.isGroupable,
  10416. isGroupable = _ref$isGroupable === void 0 ? false : _ref$isGroupable,
  10417. _ref$isUngroupable = _ref.isUngroupable,
  10418. isUngroupable = _ref$isUngroupable === void 0 ? false : _ref$isUngroupable;
  10419. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, isGroupable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], {
  10420. className: "editor-block-settings-menu__control block-editor-block-settings-menu__control",
  10421. icon: Group,
  10422. onClick: onConvertToGroup
  10423. }, Object(external_this_wp_i18n_["_x"])('Group', 'verb')), isUngroupable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], {
  10424. className: "editor-block-settings-menu__control block-editor-block-settings-menu__control",
  10425. icon: Ungroup,
  10426. onClick: onConvertFromGroup
  10427. }, Object(external_this_wp_i18n_["_x"])('Ungroup', 'Ungrouping blocks from within a Group block back into individual blocks within the Editor ')));
  10428. }
  10429. /* harmony default export */ var convert_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) {
  10430. var clientIds = _ref2.clientIds;
  10431. var _select = select('core/block-editor'),
  10432. getBlockRootClientId = _select.getBlockRootClientId,
  10433. getBlocksByClientId = _select.getBlocksByClientId,
  10434. canInsertBlockType = _select.canInsertBlockType;
  10435. var _select2 = select('core/blocks'),
  10436. getGroupingBlockName = _select2.getGroupingBlockName;
  10437. var groupingBlockName = getGroupingBlockName();
  10438. var rootClientId = clientIds && clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : undefined;
  10439. var groupingBlockAvailable = canInsertBlockType(groupingBlockName, rootClientId);
  10440. var blocksSelection = getBlocksByClientId(clientIds);
  10441. var isSingleGroupingBlock = blocksSelection.length === 1 && blocksSelection[0] && blocksSelection[0].name === groupingBlockName; // Do we have
  10442. // 1. Grouping block available to be inserted?
  10443. // 2. One or more blocks selected
  10444. // (we allow single Blocks to become groups unless
  10445. // they are a soltiary group block themselves)
  10446. var isGroupable = groupingBlockAvailable && blocksSelection.length && !isSingleGroupingBlock; // Do we have a single Group Block selected and does that group have inner blocks?
  10447. var isUngroupable = isSingleGroupingBlock && !!blocksSelection[0].innerBlocks.length;
  10448. return {
  10449. isGroupable: isGroupable,
  10450. isUngroupable: isUngroupable,
  10451. blocksSelection: blocksSelection,
  10452. groupingBlockName: groupingBlockName
  10453. };
  10454. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3) {
  10455. var clientIds = _ref3.clientIds,
  10456. _ref3$onToggle = _ref3.onToggle,
  10457. onToggle = _ref3$onToggle === void 0 ? external_lodash_["noop"] : _ref3$onToggle,
  10458. _ref3$blocksSelection = _ref3.blocksSelection,
  10459. blocksSelection = _ref3$blocksSelection === void 0 ? [] : _ref3$blocksSelection,
  10460. groupingBlockName = _ref3.groupingBlockName;
  10461. var _dispatch = dispatch('core/block-editor'),
  10462. replaceBlocks = _dispatch.replaceBlocks;
  10463. return {
  10464. onConvertToGroup: function onConvertToGroup() {
  10465. if (!blocksSelection.length) {
  10466. return;
  10467. } // Activate the `transform` on the Grouping Block which does the conversion
  10468. var newBlocks = Object(external_this_wp_blocks_["switchToBlockType"])(blocksSelection, groupingBlockName);
  10469. if (newBlocks) {
  10470. replaceBlocks(clientIds, newBlocks);
  10471. }
  10472. onToggle();
  10473. },
  10474. onConvertFromGroup: function onConvertFromGroup() {
  10475. if (!blocksSelection.length) {
  10476. return;
  10477. }
  10478. var innerBlocks = blocksSelection[0].innerBlocks;
  10479. if (!innerBlocks.length) {
  10480. return;
  10481. }
  10482. replaceBlocks(clientIds, innerBlocks);
  10483. onToggle();
  10484. }
  10485. };
  10486. })])(ConvertToGroupButton));
  10487. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/convert-to-group-buttons/index.js
  10488. /**
  10489. * WordPress dependencies
  10490. */
  10491. /**
  10492. * Internal dependencies
  10493. */
  10494. function ConvertToGroupButtons(_ref) {
  10495. var clientIds = _ref.clientIds;
  10496. return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlockSettingsMenuPluginsExtension"], null, function (_ref2) {
  10497. var onClose = _ref2.onClose;
  10498. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(convert_button, {
  10499. clientIds: clientIds,
  10500. onToggle: onClose
  10501. }));
  10502. });
  10503. }
  10504. /* harmony default export */ var convert_to_group_buttons = (Object(external_this_wp_data_["withSelect"])(function (select) {
  10505. var _select = select('core/block-editor'),
  10506. getSelectedBlockClientIds = _select.getSelectedBlockClientIds;
  10507. return {
  10508. clientIds: getSelectedBlockClientIds()
  10509. };
  10510. })(ConvertToGroupButtons));
  10511. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/reducer.js
  10512. /**
  10513. * WordPress dependencies
  10514. */
  10515. /**
  10516. * Reducer returning an array of downloadable blocks.
  10517. *
  10518. * @param {Object} state Current state.
  10519. * @param {Object} action Dispatched action.
  10520. *
  10521. * @return {Object} Updated state.
  10522. */
  10523. var reducer_downloadableBlocks = function downloadableBlocks() {
  10524. var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  10525. results: {},
  10526. hasPermission: true,
  10527. filterValue: undefined,
  10528. isRequestingDownloadableBlocks: true,
  10529. installedBlockTypes: []
  10530. };
  10531. var action = arguments.length > 1 ? arguments[1] : undefined;
  10532. switch (action.type) {
  10533. case 'FETCH_DOWNLOADABLE_BLOCKS':
  10534. return Object(objectSpread["a" /* default */])({}, state, {
  10535. isRequestingDownloadableBlocks: true
  10536. });
  10537. case 'RECEIVE_DOWNLOADABLE_BLOCKS':
  10538. return Object(objectSpread["a" /* default */])({}, state, {
  10539. results: Object.assign({}, state.results, Object(defineProperty["a" /* default */])({}, action.filterValue, action.downloadableBlocks)),
  10540. hasPermission: true,
  10541. isRequestingDownloadableBlocks: false
  10542. });
  10543. case 'SET_INSTALL_BLOCKS_PERMISSION':
  10544. return Object(objectSpread["a" /* default */])({}, state, {
  10545. items: action.hasPermission ? state.items : [],
  10546. hasPermission: action.hasPermission
  10547. });
  10548. case 'ADD_INSTALLED_BLOCK_TYPE':
  10549. return Object(objectSpread["a" /* default */])({}, state, {
  10550. installedBlockTypes: [].concat(Object(toConsumableArray["a" /* default */])(state.installedBlockTypes), [action.item])
  10551. });
  10552. case 'REMOVE_INSTALLED_BLOCK_TYPE':
  10553. return Object(objectSpread["a" /* default */])({}, state, {
  10554. installedBlockTypes: state.installedBlockTypes.filter(function (blockType) {
  10555. return blockType.name !== action.item.name;
  10556. })
  10557. });
  10558. }
  10559. return state;
  10560. };
  10561. /* harmony default export */ var store_reducer = (Object(external_this_wp_data_["combineReducers"])({
  10562. downloadableBlocks: reducer_downloadableBlocks
  10563. }));
  10564. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js
  10565. /**
  10566. * External dependencies
  10567. */
  10568. /**
  10569. * Returns true if application is requesting for downloadable blocks.
  10570. *
  10571. * @param {Object} state Global application state.
  10572. *
  10573. * @return {Array} Downloadable blocks
  10574. */
  10575. function isRequestingDownloadableBlocks(state) {
  10576. return state.downloadableBlocks.isRequestingDownloadableBlocks;
  10577. }
  10578. /**
  10579. * Returns the available uninstalled blocks
  10580. *
  10581. * @param {Object} state Global application state.
  10582. * @param {string} filterValue Search string.
  10583. *
  10584. * @return {Array} Downloadable blocks
  10585. */
  10586. function selectors_getDownloadableBlocks(state, filterValue) {
  10587. if (!state.downloadableBlocks.results[filterValue]) {
  10588. return [];
  10589. }
  10590. return state.downloadableBlocks.results[filterValue];
  10591. }
  10592. /**
  10593. * Returns true if user has permission to install blocks.
  10594. *
  10595. * @param {Object} state Global application state.
  10596. *
  10597. * @return {boolean} User has permission to install blocks.
  10598. */
  10599. function selectors_hasInstallBlocksPermission(state) {
  10600. return state.downloadableBlocks.hasPermission;
  10601. }
  10602. /**
  10603. * Returns the block types that have been installed on the server.
  10604. *
  10605. * @param {Object} state Global application state.
  10606. *
  10607. * @return {Array} Block type items.
  10608. */
  10609. function selectors_getInstalledBlockTypes(state) {
  10610. return Object(external_lodash_["get"])(state, ['downloadableBlocks', 'installedBlockTypes'], []);
  10611. }
  10612. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/controls.js
  10613. var controls_marked =
  10614. /*#__PURE__*/
  10615. regenerator_default.a.mark(loadAssets);
  10616. /**
  10617. * External dependencies
  10618. */
  10619. /**
  10620. * WordPress dependencies
  10621. */
  10622. /**
  10623. * Calls a selector using the current state.
  10624. *
  10625. * @param {string} storeName Store name.
  10626. * @param {string} selectorName Selector name.
  10627. * @param {Array} args Selector arguments.
  10628. *
  10629. * @return {Object} Control descriptor.
  10630. */
  10631. function controls_select(storeName, selectorName) {
  10632. for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  10633. args[_key - 2] = arguments[_key];
  10634. }
  10635. return {
  10636. type: 'SELECT',
  10637. storeName: storeName,
  10638. selectorName: selectorName,
  10639. args: args
  10640. };
  10641. }
  10642. /**
  10643. * Calls a dispatcher using the current state.
  10644. *
  10645. * @param {string} storeName Store name.
  10646. * @param {string} dispatcherName Dispatcher name.
  10647. * @param {Array} args Selector arguments.
  10648. *
  10649. * @return {Object} Control descriptor.
  10650. */
  10651. function controls_dispatch(storeName, dispatcherName) {
  10652. for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
  10653. args[_key2 - 2] = arguments[_key2];
  10654. }
  10655. return {
  10656. type: 'DISPATCH',
  10657. storeName: storeName,
  10658. dispatcherName: dispatcherName,
  10659. args: args
  10660. };
  10661. }
  10662. /**
  10663. * Trigger an API Fetch request.
  10664. *
  10665. * @param {Object} request API Fetch Request Object.
  10666. *
  10667. * @return {Object} Control descriptor.
  10668. */
  10669. function apiFetch(request) {
  10670. return {
  10671. type: 'API_FETCH',
  10672. request: request
  10673. };
  10674. }
  10675. /**
  10676. * Loads JavaScript
  10677. *
  10678. * @param {Array} asset The url for the JavaScript.
  10679. * @param {Function} onLoad Callback function on success.
  10680. * @param {Function} onError Callback function on failure.
  10681. */
  10682. var loadScript = function loadScript(asset, onLoad, onError) {
  10683. if (!asset) {
  10684. return;
  10685. }
  10686. var existing = document.querySelector("script[src=\"".concat(asset.src, "\"]"));
  10687. if (existing) {
  10688. existing.parentNode.removeChild(existing);
  10689. }
  10690. var script = document.createElement('script');
  10691. script.src = typeof asset === 'string' ? asset : asset.src;
  10692. script.onload = onLoad;
  10693. script.onerror = onError;
  10694. document.body.appendChild(script);
  10695. };
  10696. /**
  10697. * Loads CSS file.
  10698. *
  10699. * @param {*} asset the url for the CSS file.
  10700. */
  10701. var loadStyle = function loadStyle(asset) {
  10702. if (!asset) {
  10703. return;
  10704. }
  10705. var link = document.createElement('link');
  10706. link.rel = 'stylesheet';
  10707. link.href = typeof asset === 'string' ? asset : asset.src;
  10708. document.body.appendChild(link);
  10709. };
  10710. /**
  10711. * Load the asset files for a block
  10712. *
  10713. * @param {Array} assets A collection of URL for the assets.
  10714. *
  10715. * @return {Object} Control descriptor.
  10716. */
  10717. function loadAssets(assets) {
  10718. return regenerator_default.a.wrap(function loadAssets$(_context) {
  10719. while (1) {
  10720. switch (_context.prev = _context.next) {
  10721. case 0:
  10722. return _context.abrupt("return", {
  10723. type: 'LOAD_ASSETS',
  10724. assets: assets
  10725. });
  10726. case 1:
  10727. case "end":
  10728. return _context.stop();
  10729. }
  10730. }
  10731. }, controls_marked);
  10732. }
  10733. var controls_controls = {
  10734. SELECT: Object(external_this_wp_data_["createRegistryControl"])(function (registry) {
  10735. return function (_ref) {
  10736. var _registry$select;
  10737. var storeName = _ref.storeName,
  10738. selectorName = _ref.selectorName,
  10739. args = _ref.args;
  10740. return (_registry$select = registry.select(storeName))[selectorName].apply(_registry$select, Object(toConsumableArray["a" /* default */])(args));
  10741. };
  10742. }),
  10743. DISPATCH: Object(external_this_wp_data_["createRegistryControl"])(function (registry) {
  10744. return function (_ref2) {
  10745. var _registry$dispatch;
  10746. var storeName = _ref2.storeName,
  10747. dispatcherName = _ref2.dispatcherName,
  10748. args = _ref2.args;
  10749. return (_registry$dispatch = registry.dispatch(storeName))[dispatcherName].apply(_registry$dispatch, Object(toConsumableArray["a" /* default */])(args));
  10750. };
  10751. }),
  10752. API_FETCH: function API_FETCH(_ref3) {
  10753. var request = _ref3.request;
  10754. return external_this_wp_apiFetch_default()(Object(objectSpread["a" /* default */])({}, request));
  10755. },
  10756. LOAD_ASSETS: function LOAD_ASSETS(_ref4) {
  10757. var assets = _ref4.assets;
  10758. return new Promise(function (resolve, reject) {
  10759. if (Array.isArray(assets)) {
  10760. var scriptsCount = 0;
  10761. Object(external_lodash_["forEach"])(assets, function (asset) {
  10762. if (asset.match(/\.js$/) !== null) {
  10763. scriptsCount++;
  10764. loadScript(asset, function () {
  10765. scriptsCount--;
  10766. if (scriptsCount === 0) {
  10767. return resolve(scriptsCount);
  10768. }
  10769. }, reject);
  10770. } else {
  10771. loadStyle(asset);
  10772. }
  10773. });
  10774. } else {
  10775. loadScript(assets.editor_script, function () {
  10776. return resolve(0);
  10777. }, reject);
  10778. loadStyle(assets.style);
  10779. }
  10780. });
  10781. }
  10782. };
  10783. /* harmony default export */ var build_module_store_controls = (controls_controls);
  10784. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/actions.js
  10785. var store_actions_marked =
  10786. /*#__PURE__*/
  10787. regenerator_default.a.mark(actions_downloadBlock),
  10788. store_actions_marked2 =
  10789. /*#__PURE__*/
  10790. regenerator_default.a.mark(actions_installBlock),
  10791. actions_marked3 =
  10792. /*#__PURE__*/
  10793. regenerator_default.a.mark(uninstallBlock);
  10794. /**
  10795. * WordPress dependencies
  10796. */
  10797. /**
  10798. * Internal dependencies
  10799. */
  10800. /**
  10801. * Returns an action object used in signalling that the downloadable blocks have been requested and is loading.
  10802. *
  10803. * @return {Object} Action object.
  10804. */
  10805. function fetchDownloadableBlocks() {
  10806. return {
  10807. type: 'FETCH_DOWNLOADABLE_BLOCKS'
  10808. };
  10809. }
  10810. /**
  10811. * Returns an action object used in signalling that the downloadable blocks have been updated.
  10812. *
  10813. * @param {Array} downloadableBlocks Downloadable blocks.
  10814. * @param {string} filterValue Search string.
  10815. *
  10816. * @return {Object} Action object.
  10817. */
  10818. function receiveDownloadableBlocks(downloadableBlocks, filterValue) {
  10819. return {
  10820. type: 'RECEIVE_DOWNLOADABLE_BLOCKS',
  10821. downloadableBlocks: downloadableBlocks,
  10822. filterValue: filterValue
  10823. };
  10824. }
  10825. /**
  10826. * Returns an action object used in signalling that the user does not have permission to install blocks.
  10827. *
  10828. @param {boolean} hasPermission User has permission to install blocks.
  10829. *
  10830. * @return {Object} Action object.
  10831. */
  10832. function setInstallBlocksPermission(hasPermission) {
  10833. return {
  10834. type: 'SET_INSTALL_BLOCKS_PERMISSION',
  10835. hasPermission: hasPermission
  10836. };
  10837. }
  10838. /**
  10839. * Action triggered to download block assets.
  10840. *
  10841. * @param {Object} item The selected block item
  10842. * @param {Function} onSuccess The callback function when the action has succeeded.
  10843. * @param {Function} onError The callback function when the action has failed.
  10844. */
  10845. function actions_downloadBlock(item, onSuccess, onError) {
  10846. var registeredBlocks;
  10847. return regenerator_default.a.wrap(function downloadBlock$(_context) {
  10848. while (1) {
  10849. switch (_context.prev = _context.next) {
  10850. case 0:
  10851. _context.prev = 0;
  10852. if (item.assets.length) {
  10853. _context.next = 3;
  10854. break;
  10855. }
  10856. throw new Error('Block has no assets');
  10857. case 3:
  10858. _context.next = 5;
  10859. return loadAssets(item.assets);
  10860. case 5:
  10861. registeredBlocks = Object(external_this_wp_blocks_["getBlockTypes"])();
  10862. if (!registeredBlocks.length) {
  10863. _context.next = 10;
  10864. break;
  10865. }
  10866. onSuccess(item);
  10867. _context.next = 11;
  10868. break;
  10869. case 10:
  10870. throw new Error('Unable to get block types');
  10871. case 11:
  10872. _context.next = 17;
  10873. break;
  10874. case 13:
  10875. _context.prev = 13;
  10876. _context.t0 = _context["catch"](0);
  10877. _context.next = 17;
  10878. return onError(_context.t0);
  10879. case 17:
  10880. case "end":
  10881. return _context.stop();
  10882. }
  10883. }
  10884. }, store_actions_marked, null, [[0, 13]]);
  10885. }
  10886. /**
  10887. * Action triggered to install a block plugin.
  10888. *
  10889. * @param {string} item The block item returned by search.
  10890. * @param {Function} onSuccess The callback function when the action has succeeded.
  10891. * @param {Function} onError The callback function when the action has failed.
  10892. *
  10893. */
  10894. function actions_installBlock(_ref, onSuccess, onError) {
  10895. var id, name, response;
  10896. return regenerator_default.a.wrap(function installBlock$(_context2) {
  10897. while (1) {
  10898. switch (_context2.prev = _context2.next) {
  10899. case 0:
  10900. id = _ref.id, name = _ref.name;
  10901. _context2.prev = 1;
  10902. _context2.next = 4;
  10903. return apiFetch({
  10904. path: '__experimental/block-directory/install',
  10905. data: {
  10906. slug: id
  10907. },
  10908. method: 'POST'
  10909. });
  10910. case 4:
  10911. response = _context2.sent;
  10912. if (!(response.success === false)) {
  10913. _context2.next = 7;
  10914. break;
  10915. }
  10916. throw new Error(response.errorMessage);
  10917. case 7:
  10918. _context2.next = 9;
  10919. return addInstalledBlockType({
  10920. id: id,
  10921. name: name
  10922. });
  10923. case 9:
  10924. onSuccess();
  10925. _context2.next = 15;
  10926. break;
  10927. case 12:
  10928. _context2.prev = 12;
  10929. _context2.t0 = _context2["catch"](1);
  10930. onError(_context2.t0);
  10931. case 15:
  10932. case "end":
  10933. return _context2.stop();
  10934. }
  10935. }
  10936. }, store_actions_marked2, null, [[1, 12]]);
  10937. }
  10938. /**
  10939. * Action triggered to uninstall a block plugin.
  10940. *
  10941. * @param {string} item The block item returned by search.
  10942. * @param {Function} onSuccess The callback function when the action has succeeded.
  10943. * @param {Function} onError The callback function when the action has failed.
  10944. *
  10945. */
  10946. function uninstallBlock(_ref2, onSuccess, onError) {
  10947. var id, name, response;
  10948. return regenerator_default.a.wrap(function uninstallBlock$(_context3) {
  10949. while (1) {
  10950. switch (_context3.prev = _context3.next) {
  10951. case 0:
  10952. id = _ref2.id, name = _ref2.name;
  10953. _context3.prev = 1;
  10954. _context3.next = 4;
  10955. return apiFetch({
  10956. path: '__experimental/block-directory/uninstall',
  10957. data: {
  10958. slug: id
  10959. },
  10960. method: 'DELETE'
  10961. });
  10962. case 4:
  10963. response = _context3.sent;
  10964. if (!(response.success === false)) {
  10965. _context3.next = 7;
  10966. break;
  10967. }
  10968. throw new Error(response.errorMessage);
  10969. case 7:
  10970. _context3.next = 9;
  10971. return removeInstalledBlockType({
  10972. id: id,
  10973. name: name
  10974. });
  10975. case 9:
  10976. onSuccess();
  10977. _context3.next = 15;
  10978. break;
  10979. case 12:
  10980. _context3.prev = 12;
  10981. _context3.t0 = _context3["catch"](1);
  10982. onError(_context3.t0);
  10983. case 15:
  10984. case "end":
  10985. return _context3.stop();
  10986. }
  10987. }
  10988. }, actions_marked3, null, [[1, 12]]);
  10989. }
  10990. /**
  10991. * Returns an action object used to add a newly installed block type.
  10992. *
  10993. * @param {string} item The block item with the block id and name.
  10994. *
  10995. * @return {Object} Action object.
  10996. */
  10997. function addInstalledBlockType(item) {
  10998. return {
  10999. type: 'ADD_INSTALLED_BLOCK_TYPE',
  11000. item: item
  11001. };
  11002. }
  11003. /**
  11004. * Returns an action object used to remove a newly installed block type.
  11005. *
  11006. * @param {string} item The block item with the block id and name.
  11007. *
  11008. * @return {Object} Action object.
  11009. */
  11010. function removeInstalledBlockType(item) {
  11011. return {
  11012. type: 'REMOVE_INSTALLED_BLOCK_TYPE',
  11013. item: item
  11014. };
  11015. }
  11016. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js
  11017. /**
  11018. * External dependencies
  11019. */
  11020. /**
  11021. * Internal dependencies
  11022. */
  11023. /* harmony default export */ var resolvers = ({
  11024. getDownloadableBlocks:
  11025. /*#__PURE__*/
  11026. regenerator_default.a.mark(function getDownloadableBlocks(filterValue) {
  11027. var results, blocks;
  11028. return regenerator_default.a.wrap(function getDownloadableBlocks$(_context) {
  11029. while (1) {
  11030. switch (_context.prev = _context.next) {
  11031. case 0:
  11032. if (filterValue) {
  11033. _context.next = 2;
  11034. break;
  11035. }
  11036. return _context.abrupt("return");
  11037. case 2:
  11038. _context.prev = 2;
  11039. _context.next = 5;
  11040. return fetchDownloadableBlocks(filterValue);
  11041. case 5:
  11042. _context.next = 7;
  11043. return apiFetch({
  11044. path: "__experimental/block-directory/search?term=".concat(filterValue)
  11045. });
  11046. case 7:
  11047. results = _context.sent;
  11048. blocks = results.map(function (result) {
  11049. return Object(external_lodash_["mapKeys"])(result, function (value, key) {
  11050. return Object(external_lodash_["camelCase"])(key);
  11051. });
  11052. });
  11053. _context.next = 11;
  11054. return receiveDownloadableBlocks(blocks, filterValue);
  11055. case 11:
  11056. _context.next = 18;
  11057. break;
  11058. case 13:
  11059. _context.prev = 13;
  11060. _context.t0 = _context["catch"](2);
  11061. if (!(_context.t0.code === 'rest_user_cannot_view')) {
  11062. _context.next = 18;
  11063. break;
  11064. }
  11065. _context.next = 18;
  11066. return setInstallBlocksPermission(false);
  11067. case 18:
  11068. case "end":
  11069. return _context.stop();
  11070. }
  11071. }
  11072. }, getDownloadableBlocks, null, [[2, 13]]);
  11073. }),
  11074. hasInstallBlocksPermission:
  11075. /*#__PURE__*/
  11076. regenerator_default.a.mark(function hasInstallBlocksPermission() {
  11077. return regenerator_default.a.wrap(function hasInstallBlocksPermission$(_context2) {
  11078. while (1) {
  11079. switch (_context2.prev = _context2.next) {
  11080. case 0:
  11081. _context2.prev = 0;
  11082. _context2.next = 3;
  11083. return apiFetch({
  11084. path: "__experimental/block-directory/search?term="
  11085. });
  11086. case 3:
  11087. _context2.next = 5;
  11088. return setInstallBlocksPermission(true);
  11089. case 5:
  11090. _context2.next = 12;
  11091. break;
  11092. case 7:
  11093. _context2.prev = 7;
  11094. _context2.t0 = _context2["catch"](0);
  11095. if (!(_context2.t0.code === 'rest_user_cannot_view')) {
  11096. _context2.next = 12;
  11097. break;
  11098. }
  11099. _context2.next = 12;
  11100. return setInstallBlocksPermission(false);
  11101. case 12:
  11102. case "end":
  11103. return _context2.stop();
  11104. }
  11105. }
  11106. }, hasInstallBlocksPermission, null, [[0, 7]]);
  11107. })
  11108. });
  11109. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/index.js
  11110. /**
  11111. * WordPress dependencies
  11112. */
  11113. /**
  11114. * Internal dependencies
  11115. */
  11116. /**
  11117. * Module Constants
  11118. */
  11119. var MODULE_KEY = 'core/block-directory';
  11120. /**
  11121. * Block editor data store configuration.
  11122. *
  11123. * @see https://github.com/WordPress/gutenberg/blob/master/packages/data/README.md#registerStore
  11124. *
  11125. * @type {Object}
  11126. */
  11127. var store_storeConfig = {
  11128. reducer: store_reducer,
  11129. selectors: store_selectors_namespaceObject,
  11130. actions: store_actions_namespaceObject,
  11131. controls: build_module_store_controls,
  11132. resolvers: resolvers
  11133. };
  11134. var build_module_store_store = Object(external_this_wp_data_["registerStore"])(MODULE_KEY, store_storeConfig);
  11135. /* harmony default export */ var block_directory_build_module_store = (build_module_store_store);
  11136. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/stars.js
  11137. /**
  11138. * External dependencies
  11139. */
  11140. /**
  11141. * WordPress dependencies
  11142. */
  11143. function Stars(_ref) {
  11144. var rating = _ref.rating;
  11145. var stars = Math.round(rating / 0.5) * 0.5;
  11146. var fullStarCount = Math.floor(rating);
  11147. var halfStarCount = Math.ceil(rating - fullStarCount);
  11148. var emptyStarCount = 5 - (fullStarCount + halfStarCount);
  11149. return Object(external_this_wp_element_["createElement"])("div", {
  11150. "aria-label": Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('%s out of 5 stars'), stars)
  11151. }, Object(external_lodash_["times"])(fullStarCount, function (i) {
  11152. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
  11153. key: "full_stars_".concat(i),
  11154. icon: "star-filled",
  11155. size: 16
  11156. });
  11157. }), Object(external_lodash_["times"])(halfStarCount, function (i) {
  11158. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
  11159. key: "half_stars_".concat(i),
  11160. icon: "star-half",
  11161. size: 16
  11162. });
  11163. }), Object(external_lodash_["times"])(emptyStarCount, function (i) {
  11164. return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
  11165. key: "empty_stars_".concat(i),
  11166. icon: "star-empty",
  11167. size: 16
  11168. });
  11169. }));
  11170. }
  11171. /* harmony default export */ var block_ratings_stars = (Stars);
  11172. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/index.js
  11173. /**
  11174. * WordPress dependencies
  11175. */
  11176. /**
  11177. * Internal dependencies
  11178. */
  11179. var block_ratings_BlockRatings = function BlockRatings(_ref) {
  11180. var rating = _ref.rating,
  11181. ratingCount = _ref.ratingCount;
  11182. return Object(external_this_wp_element_["createElement"])("div", {
  11183. className: "block-directory-block-ratings"
  11184. }, Object(external_this_wp_element_["createElement"])(block_ratings_stars, {
  11185. rating: rating
  11186. }), Object(external_this_wp_element_["createElement"])("span", {
  11187. className: "block-directory-block-ratings__rating-count",
  11188. "aria-label": // translators: %d: number of ratings (number).
  11189. Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d total rating', '%d total ratings', ratingCount), ratingCount)
  11190. }, "(", ratingCount, ")"));
  11191. };
  11192. /* harmony default export */ var block_ratings = (block_ratings_BlockRatings);
  11193. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-header/index.js
  11194. /**
  11195. * WordPress dependencies
  11196. */
  11197. /**
  11198. * Internal dependencies
  11199. */
  11200. function DownloadableBlockHeader(_ref) {
  11201. var icon = _ref.icon,
  11202. title = _ref.title,
  11203. rating = _ref.rating,
  11204. ratingCount = _ref.ratingCount,
  11205. _onClick = _ref.onClick;
  11206. return Object(external_this_wp_element_["createElement"])("div", {
  11207. className: "block-directory-downloadable-block-header__row"
  11208. }, icon.match(/\.(jpeg|jpg|gif|png)$/) !== null ? Object(external_this_wp_element_["createElement"])("img", {
  11209. src: icon,
  11210. alt: "block icon"
  11211. }) : Object(external_this_wp_element_["createElement"])("span", null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], {
  11212. icon: icon,
  11213. showColors: true
  11214. })), Object(external_this_wp_element_["createElement"])("div", {
  11215. className: "block-directory-downloadable-block-header__column"
  11216. }, Object(external_this_wp_element_["createElement"])("span", {
  11217. role: "heading",
  11218. className: "block-directory-downloadable-block-header__title"
  11219. }, title), Object(external_this_wp_element_["createElement"])(block_ratings, {
  11220. rating: rating,
  11221. ratingCount: ratingCount
  11222. })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
  11223. isDefault: true,
  11224. onClick: function onClick(event) {
  11225. event.preventDefault();
  11226. _onClick();
  11227. }
  11228. }, Object(external_this_wp_i18n_["__"])('Add')));
  11229. }
  11230. /* harmony default export */ var downloadable_block_header = (DownloadableBlockHeader);
  11231. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-author-info/index.js
  11232. /**
  11233. * WordPress dependencies
  11234. */
  11235. function DownloadableBlockAuthorInfo(_ref) {
  11236. var author = _ref.author,
  11237. authorBlockCount = _ref.authorBlockCount,
  11238. authorBlockRating = _ref.authorBlockRating;
  11239. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("span", {
  11240. className: "block-directory-downloadable-block-author-info__content-author"
  11241. }, Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Authored by %s'), author)), Object(external_this_wp_element_["createElement"])("span", {
  11242. className: "block-directory-downloadable-block-author-info__content"
  11243. }, Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('This author has %d block, with an average rating of %d.', 'This author has %d blocks, with an average rating of %d.', authorBlockCount), authorBlockCount, authorBlockRating)));
  11244. }
  11245. /* harmony default export */ var downloadable_block_author_info = (DownloadableBlockAuthorInfo);
  11246. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-info/index.js
  11247. /**
  11248. * WordPress dependencies
  11249. */
  11250. function DownloadableBlockInfo(_ref) {
  11251. var description = _ref.description,
  11252. activeInstalls = _ref.activeInstalls,
  11253. humanizedUpdated = _ref.humanizedUpdated;
  11254. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("p", {
  11255. className: "block-directory-downloadable-block-info__content"
  11256. }, description), Object(external_this_wp_element_["createElement"])("div", {
  11257. className: "block-directory-downloadable-block-info__row"
  11258. }, Object(external_this_wp_element_["createElement"])("div", {
  11259. className: "block-directory-downloadable-block-info__column"
  11260. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
  11261. icon: "chart-line"
  11262. }), Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d active installation', '%d active installations', activeInstalls), activeInstalls)), Object(external_this_wp_element_["createElement"])("div", {
  11263. className: "block-directory-downloadable-block-info__column"
  11264. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
  11265. icon: "update"
  11266. }), Object(external_this_wp_element_["createElement"])("span", {
  11267. "aria-label": Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Updated %s'), humanizedUpdated)
  11268. }, humanizedUpdated))));
  11269. }
  11270. /* harmony default export */ var downloadable_block_info = (DownloadableBlockInfo);
  11271. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-list-item/index.js
  11272. /**
  11273. * Internal dependencies
  11274. */
  11275. function DownloadableBlockListItem(_ref) {
  11276. var item = _ref.item,
  11277. onClick = _ref.onClick;
  11278. var icon = item.icon,
  11279. title = item.title,
  11280. description = item.description,
  11281. rating = item.rating,
  11282. activeInstalls = item.activeInstalls,
  11283. ratingCount = item.ratingCount,
  11284. author = item.author,
  11285. humanizedUpdated = item.humanizedUpdated,
  11286. authorBlockCount = item.authorBlockCount,
  11287. authorBlockRating = item.authorBlockRating;
  11288. return Object(external_this_wp_element_["createElement"])("li", {
  11289. className: "block-directory-downloadable-block-list-item"
  11290. }, Object(external_this_wp_element_["createElement"])("article", {
  11291. className: "block-directory-downloadable-block-list-item__panel"
  11292. }, Object(external_this_wp_element_["createElement"])("header", {
  11293. className: "block-directory-downloadable-block-list-item__header"
  11294. }, Object(external_this_wp_element_["createElement"])(downloadable_block_header, {
  11295. icon: icon,
  11296. onClick: onClick,
  11297. title: title,
  11298. rating: rating,
  11299. ratingCount: ratingCount
  11300. })), Object(external_this_wp_element_["createElement"])("section", {
  11301. className: "block-directory-downloadable-block-list-item__body"
  11302. }, Object(external_this_wp_element_["createElement"])(downloadable_block_info, {
  11303. activeInstalls: activeInstalls,
  11304. description: description,
  11305. humanizedUpdated: humanizedUpdated
  11306. })), Object(external_this_wp_element_["createElement"])("footer", {
  11307. className: "block-directory-downloadable-block-list-item__footer"
  11308. }, Object(external_this_wp_element_["createElement"])(downloadable_block_author_info, {
  11309. author: author,
  11310. authorBlockCount: authorBlockCount,
  11311. authorBlockRating: authorBlockRating
  11312. }))));
  11313. }
  11314. /* harmony default export */ var downloadable_block_list_item = (DownloadableBlockListItem);
  11315. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-list/index.js
  11316. /**
  11317. * External dependencies
  11318. */
  11319. /**
  11320. * WordPress dependencies
  11321. */
  11322. /**
  11323. * Internal dependencies
  11324. */
  11325. var DOWNLOAD_ERROR_NOTICE_ID = 'block-download-error';
  11326. var INSTALL_ERROR_NOTICE_ID = 'block-install-error';
  11327. function DownloadableBlocksList(_ref) {
  11328. var items = _ref.items,
  11329. _ref$onHover = _ref.onHover,
  11330. onHover = _ref$onHover === void 0 ? external_lodash_["noop"] : _ref$onHover,
  11331. children = _ref.children,
  11332. downloadAndInstallBlock = _ref.downloadAndInstallBlock;
  11333. return (
  11334. /*
  11335. * Disable reason: The `list` ARIA role is redundant but
  11336. * Safari+VoiceOver won't announce the list otherwise.
  11337. */
  11338. /* eslint-disable jsx-a11y/no-redundant-roles */
  11339. Object(external_this_wp_element_["createElement"])("ul", {
  11340. role: "list",
  11341. className: "block-directory-downloadable-blocks-list"
  11342. }, items && items.map(function (item) {
  11343. return Object(external_this_wp_element_["createElement"])(downloadable_block_list_item, {
  11344. key: item.id,
  11345. className: Object(external_this_wp_blocks_["getBlockMenuDefaultClassName"])(item.id),
  11346. icons: item.icons,
  11347. onClick: function onClick() {
  11348. downloadAndInstallBlock(item);
  11349. onHover(null);
  11350. },
  11351. onFocus: function onFocus() {
  11352. return onHover(item);
  11353. },
  11354. onMouseEnter: function onMouseEnter() {
  11355. return onHover(item);
  11356. },
  11357. onMouseLeave: function onMouseLeave() {
  11358. return onHover(null);
  11359. },
  11360. onBlur: function onBlur() {
  11361. return onHover(null);
  11362. },
  11363. item: item
  11364. });
  11365. }), children)
  11366. /* eslint-enable jsx-a11y/no-redundant-roles */
  11367. );
  11368. }
  11369. /* harmony default export */ var downloadable_blocks_list = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withDispatch"])(function (dispatch, props) {
  11370. var _dispatch = dispatch('core/block-directory'),
  11371. installBlock = _dispatch.installBlock,
  11372. downloadBlock = _dispatch.downloadBlock;
  11373. var _dispatch2 = dispatch('core/notices'),
  11374. createErrorNotice = _dispatch2.createErrorNotice,
  11375. removeNotice = _dispatch2.removeNotice;
  11376. var _dispatch3 = dispatch('core/block-editor'),
  11377. removeBlocks = _dispatch3.removeBlocks;
  11378. var onSelect = props.onSelect;
  11379. return {
  11380. downloadAndInstallBlock: function downloadAndInstallBlock(item) {
  11381. var onDownloadError = function onDownloadError() {
  11382. createErrorNotice(Object(external_this_wp_i18n_["__"])('Block previews can’t load.'), {
  11383. id: DOWNLOAD_ERROR_NOTICE_ID,
  11384. actions: [{
  11385. label: Object(external_this_wp_i18n_["__"])('Retry'),
  11386. onClick: function onClick() {
  11387. removeNotice(DOWNLOAD_ERROR_NOTICE_ID);
  11388. downloadBlock(item, onSuccess, onDownloadError);
  11389. }
  11390. }]
  11391. });
  11392. };
  11393. var onSuccess = function onSuccess() {
  11394. var createdBlock = onSelect(item);
  11395. var onInstallBlockError = function onInstallBlockError() {
  11396. createErrorNotice(Object(external_this_wp_i18n_["__"])('Block previews can\'t install.'), {
  11397. id: INSTALL_ERROR_NOTICE_ID,
  11398. actions: [{
  11399. label: Object(external_this_wp_i18n_["__"])('Retry'),
  11400. onClick: function onClick() {
  11401. removeNotice(INSTALL_ERROR_NOTICE_ID);
  11402. installBlock(item, external_lodash_["noop"], onInstallBlockError);
  11403. }
  11404. }, {
  11405. label: Object(external_this_wp_i18n_["__"])('Remove'),
  11406. onClick: function onClick() {
  11407. removeNotice(INSTALL_ERROR_NOTICE_ID);
  11408. removeBlocks(createdBlock.clientId);
  11409. Object(external_this_wp_blocks_["unregisterBlockType"])(item.name);
  11410. }
  11411. }]
  11412. });
  11413. };
  11414. installBlock(item, external_lodash_["noop"], onInstallBlockError);
  11415. };
  11416. downloadBlock(item, onSuccess, onDownloadError);
  11417. }
  11418. };
  11419. }))(DownloadableBlocksList));
  11420. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/index.js
  11421. /**
  11422. * WordPress dependencies
  11423. */
  11424. /**
  11425. * Internal dependencies
  11426. */
  11427. function DownloadableBlocksPanel(_ref) {
  11428. var downloadableItems = _ref.downloadableItems,
  11429. onSelect = _ref.onSelect,
  11430. onHover = _ref.onHover,
  11431. hasPermission = _ref.hasPermission,
  11432. isLoading = _ref.isLoading,
  11433. isWaiting = _ref.isWaiting,
  11434. debouncedSpeak = _ref.debouncedSpeak;
  11435. if (!hasPermission) {
  11436. debouncedSpeak(Object(external_this_wp_i18n_["__"])('No blocks found in your library. Please contact your site administrator to install new blocks.'));
  11437. return Object(external_this_wp_element_["createElement"])("p", {
  11438. className: "block-directory-downloadable-blocks-panel__description has-no-results"
  11439. }, Object(external_this_wp_i18n_["__"])('No blocks found in your library.'), Object(external_this_wp_element_["createElement"])("br", null), Object(external_this_wp_i18n_["__"])('Please contact your site administrator to install new blocks.'));
  11440. }
  11441. if (isLoading || isWaiting) {
  11442. return Object(external_this_wp_element_["createElement"])("p", {
  11443. className: "block-directory-downloadable-blocks-panel__description has-no-results"
  11444. }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null));
  11445. }
  11446. if (!downloadableItems.length) {
  11447. return Object(external_this_wp_element_["createElement"])("p", {
  11448. className: "block-directory-downloadable-blocks-panel__description has-no-results"
  11449. }, Object(external_this_wp_i18n_["__"])('No blocks found in your library.'));
  11450. }
  11451. var resultsFoundMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('No blocks found in your library. We did find %d block available for download.', 'No blocks found in your library. We did find %d blocks available for download.', downloadableItems.length), downloadableItems.length);
  11452. debouncedSpeak(resultsFoundMessage);
  11453. return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("p", {
  11454. className: "block-directory-downloadable-blocks-panel__description"
  11455. }, Object(external_this_wp_i18n_["__"])('No blocks found in your library. These blocks can be downloaded and installed:')), Object(external_this_wp_element_["createElement"])(downloadable_blocks_list, {
  11456. items: downloadableItems,
  11457. onSelect: onSelect,
  11458. onHover: onHover
  11459. }));
  11460. }
  11461. /* harmony default export */ var downloadable_blocks_panel = (Object(external_this_wp_compose_["compose"])([external_this_wp_components_["withSpokenMessages"], Object(external_this_wp_data_["withSelect"])(function (select, _ref2) {
  11462. var filterValue = _ref2.filterValue;
  11463. var _select = select('core/block-directory'),
  11464. getDownloadableBlocks = _select.getDownloadableBlocks,
  11465. hasInstallBlocksPermission = _select.hasInstallBlocksPermission,
  11466. isRequestingDownloadableBlocks = _select.isRequestingDownloadableBlocks;
  11467. var hasPermission = hasInstallBlocksPermission();
  11468. var downloadableItems = hasPermission ? getDownloadableBlocks(filterValue) : [];
  11469. var isLoading = isRequestingDownloadableBlocks();
  11470. return {
  11471. downloadableItems: downloadableItems,
  11472. hasPermission: hasPermission,
  11473. isLoading: isLoading
  11474. };
  11475. })])(DownloadableBlocksPanel));
  11476. // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/index.js
  11477. /**
  11478. * Internal dependencies
  11479. */
  11480. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inserter-menu-downloadable-blocks-panel/index.js
  11481. /**
  11482. * External dependencies
  11483. */
  11484. /**
  11485. * WordPress dependencies
  11486. */
  11487. function InserterMenuDownloadableBlocksPanel() {
  11488. var _useState = Object(external_this_wp_element_["useState"])(''),
  11489. _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
  11490. debouncedFilterValue = _useState2[0],
  11491. setFilterValue = _useState2[1];
  11492. var debouncedSetFilterValue = Object(external_lodash_["debounce"])(setFilterValue, 400);
  11493. return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalInserterMenuExtension"], null, function (_ref) {
  11494. var onSelect = _ref.onSelect,
  11495. onHover = _ref.onHover,
  11496. filterValue = _ref.filterValue,
  11497. hasItems = _ref.hasItems;
  11498. if (hasItems || !filterValue) {
  11499. return null;
  11500. }
  11501. if (debouncedFilterValue !== filterValue) {
  11502. debouncedSetFilterValue(filterValue);
  11503. }
  11504. return Object(external_this_wp_element_["createElement"])(downloadable_blocks_panel, {
  11505. onSelect: onSelect,
  11506. onHover: onHover,
  11507. filterValue: debouncedFilterValue,
  11508. isWaiting: filterValue !== debouncedFilterValue
  11509. });
  11510. });
  11511. }
  11512. /* harmony default export */ var inserter_menu_downloadable_blocks_panel = (InserterMenuDownloadableBlocksPanel);
  11513. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js
  11514. /**
  11515. * External dependencies
  11516. */
  11517. /**
  11518. * WordPress dependencies
  11519. */
  11520. /**
  11521. * Internal dependencies
  11522. */
  11523. var fetchLinkSuggestions =
  11524. /*#__PURE__*/
  11525. function () {
  11526. var _ref = Object(asyncToGenerator["a" /* default */])(
  11527. /*#__PURE__*/
  11528. regenerator_default.a.mark(function _callee(search) {
  11529. var posts;
  11530. return regenerator_default.a.wrap(function _callee$(_context) {
  11531. while (1) {
  11532. switch (_context.prev = _context.next) {
  11533. case 0:
  11534. _context.next = 2;
  11535. return external_this_wp_apiFetch_default()({
  11536. path: Object(external_this_wp_url_["addQueryArgs"])('/wp/v2/search', {
  11537. search: search,
  11538. per_page: 20,
  11539. type: 'post'
  11540. })
  11541. });
  11542. case 2:
  11543. posts = _context.sent;
  11544. return _context.abrupt("return", Object(external_lodash_["map"])(posts, function (post) {
  11545. return {
  11546. id: post.id,
  11547. url: post.url,
  11548. title: Object(external_this_wp_htmlEntities_["decodeEntities"])(post.title) || Object(external_this_wp_i18n_["__"])('(no title)')
  11549. };
  11550. }));
  11551. case 4:
  11552. case "end":
  11553. return _context.stop();
  11554. }
  11555. }
  11556. }, _callee);
  11557. }));
  11558. return function fetchLinkSuggestions(_x) {
  11559. return _ref.apply(this, arguments);
  11560. };
  11561. }();
  11562. var UNINSTALL_ERROR_NOTICE_ID = 'block-uninstall-error';
  11563. var provider_EditorProvider =
  11564. /*#__PURE__*/
  11565. function (_Component) {
  11566. Object(inherits["a" /* default */])(EditorProvider, _Component);
  11567. function EditorProvider(props) {
  11568. var _this;
  11569. Object(classCallCheck["a" /* default */])(this, EditorProvider);
  11570. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(EditorProvider).apply(this, arguments));
  11571. _this.getBlockEditorSettings = memize_default()(_this.getBlockEditorSettings, {
  11572. maxSize: 1
  11573. }); // Assume that we don't need to initialize in the case of an error recovery.
  11574. if (props.recovery) {
  11575. return Object(possibleConstructorReturn["a" /* default */])(_this);
  11576. }
  11577. props.updatePostLock(props.settings.postLock);
  11578. props.setupEditor(props.post, props.initialEdits, props.settings.template);
  11579. if (props.settings.autosave) {
  11580. props.createWarningNotice(Object(external_this_wp_i18n_["__"])('There is an autosave of this post that is more recent than the version below.'), {
  11581. id: 'autosave-exists',
  11582. actions: [{
  11583. label: Object(external_this_wp_i18n_["__"])('View the autosave'),
  11584. url: props.settings.autosave.editLink
  11585. }]
  11586. });
  11587. }
  11588. return _this;
  11589. }
  11590. Object(createClass["a" /* default */])(EditorProvider, [{
  11591. key: "getBlockEditorSettings",
  11592. value: function getBlockEditorSettings(settings, reusableBlocks, hasUploadPermissions, canUserUseUnfilteredHTML) {
  11593. return Object(objectSpread["a" /* default */])({}, Object(external_lodash_["pick"])(settings, ['alignWide', 'allowedBlockTypes', '__experimentalPreferredStyleVariations', 'availableLegacyWidgets', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'focusMode', 'fontSizes', 'hasFixedToolbar', 'hasPermissionsToManageWidgets', 'imageSizes', 'isRTL', 'maxWidth', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'onUpdateDefaultBlockStyles', '__experimentalEnableLegacyWidgetBlock', '__experimentalEnableMenuBlock', '__experimentalBlockDirectory', 'showInserterHelpPanel']), {
  11594. __experimentalReusableBlocks: reusableBlocks,
  11595. __experimentalMediaUpload: hasUploadPermissions ? media_upload : undefined,
  11596. __experimentalFetchLinkSuggestions: fetchLinkSuggestions,
  11597. __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML
  11598. });
  11599. }
  11600. }, {
  11601. key: "componentDidMount",
  11602. value: function componentDidMount() {
  11603. this.props.updateEditorSettings(this.props.settings);
  11604. if (!this.props.settings.styles) {
  11605. return;
  11606. }
  11607. var updatedStyles = Object(external_this_wp_blockEditor_["transformStyles"])(this.props.settings.styles, '.editor-styles-wrapper');
  11608. Object(external_lodash_["map"])(updatedStyles, function (updatedCSS) {
  11609. if (updatedCSS) {
  11610. var node = document.createElement('style');
  11611. node.innerHTML = updatedCSS;
  11612. document.body.appendChild(node);
  11613. }
  11614. });
  11615. }
  11616. }, {
  11617. key: "componentDidUpdate",
  11618. value: function componentDidUpdate(prevProps) {
  11619. var _this2 = this;
  11620. if (this.props.settings !== prevProps.settings) {
  11621. this.props.updateEditorSettings(this.props.settings);
  11622. } // When a block is installed from the inserter and is unused,
  11623. // it is removed when saving the post.
  11624. // Todo: move this to the edit-post package into a separate component.
  11625. if (!Object(external_lodash_["isEqual"])(this.props.downloadableBlocksToUninstall, prevProps.downloadableBlocksToUninstall)) {
  11626. this.props.downloadableBlocksToUninstall.forEach(function (blockType) {
  11627. _this2.props.uninstallBlock(blockType, external_lodash_["noop"], function () {
  11628. _this2.props.createWarningNotice(Object(external_this_wp_i18n_["__"])('Block previews can\'t uninstall.'), {
  11629. id: UNINSTALL_ERROR_NOTICE_ID
  11630. });
  11631. });
  11632. Object(external_this_wp_blocks_["unregisterBlockType"])(blockType.name);
  11633. });
  11634. }
  11635. }
  11636. }, {
  11637. key: "componentWillUnmount",
  11638. value: function componentWillUnmount() {
  11639. this.props.tearDownEditor();
  11640. }
  11641. }, {
  11642. key: "render",
  11643. value: function render() {
  11644. var _this$props = this.props,
  11645. canUserUseUnfilteredHTML = _this$props.canUserUseUnfilteredHTML,
  11646. children = _this$props.children,
  11647. blocks = _this$props.blocks,
  11648. resetEditorBlocks = _this$props.resetEditorBlocks,
  11649. isReady = _this$props.isReady,
  11650. settings = _this$props.settings,
  11651. reusableBlocks = _this$props.reusableBlocks,
  11652. resetEditorBlocksWithoutUndoLevel = _this$props.resetEditorBlocksWithoutUndoLevel,
  11653. hasUploadPermissions = _this$props.hasUploadPermissions;
  11654. if (!isReady) {
  11655. return null;
  11656. }
  11657. var editorSettings = this.getBlockEditorSettings(settings, reusableBlocks, hasUploadPermissions, canUserUseUnfilteredHTML);
  11658. return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorProvider"], {
  11659. value: blocks,
  11660. onInput: resetEditorBlocksWithoutUndoLevel,
  11661. onChange: resetEditorBlocks,
  11662. settings: editorSettings,
  11663. useSubRegistry: false
  11664. }, children, Object(external_this_wp_element_["createElement"])(reusable_blocks_buttons, null), Object(external_this_wp_element_["createElement"])(convert_to_group_buttons, null), editorSettings.__experimentalBlockDirectory && Object(external_this_wp_element_["createElement"])(inserter_menu_downloadable_blocks_panel, null));
  11665. }
  11666. }]);
  11667. return EditorProvider;
  11668. }(external_this_wp_element_["Component"]);
  11669. /* harmony default export */ var provider = (Object(external_this_wp_compose_["compose"])([with_registry_provider, Object(external_this_wp_data_["withSelect"])(function (select) {
  11670. var _select = select('core/editor'),
  11671. canUserUseUnfilteredHTML = _select.canUserUseUnfilteredHTML,
  11672. isEditorReady = _select.__unstableIsEditorReady,
  11673. getEditorBlocks = _select.getEditorBlocks,
  11674. __experimentalGetReusableBlocks = _select.__experimentalGetReusableBlocks;
  11675. var _select2 = select('core'),
  11676. canUser = _select2.canUser;
  11677. var _select3 = select('core/block-directory'),
  11678. getInstalledBlockTypes = _select3.getInstalledBlockTypes;
  11679. var _select4 = select('core/block-editor'),
  11680. getBlocks = _select4.getBlocks;
  11681. var downloadableBlocksToUninstall = Object(external_lodash_["differenceBy"])(getInstalledBlockTypes(), getBlocks(), 'name');
  11682. return {
  11683. canUserUseUnfilteredHTML: canUserUseUnfilteredHTML(),
  11684. isReady: isEditorReady(),
  11685. blocks: getEditorBlocks(),
  11686. reusableBlocks: __experimentalGetReusableBlocks(),
  11687. hasUploadPermissions: Object(external_lodash_["defaultTo"])(canUser('create', 'media'), true),
  11688. downloadableBlocksToUninstall: downloadableBlocksToUninstall
  11689. };
  11690. }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) {
  11691. var _dispatch = dispatch('core/editor'),
  11692. setupEditor = _dispatch.setupEditor,
  11693. updatePostLock = _dispatch.updatePostLock,
  11694. resetEditorBlocks = _dispatch.resetEditorBlocks,
  11695. updateEditorSettings = _dispatch.updateEditorSettings,
  11696. __experimentalTearDownEditor = _dispatch.__experimentalTearDownEditor;
  11697. var _dispatch2 = dispatch('core/notices'),
  11698. createWarningNotice = _dispatch2.createWarningNotice;
  11699. var _dispatch3 = dispatch('core/block-directory'),
  11700. uninstallBlock = _dispatch3.uninstallBlock;
  11701. return {
  11702. setupEditor: setupEditor,
  11703. updatePostLock: updatePostLock,
  11704. createWarningNotice: createWarningNotice,
  11705. resetEditorBlocks: resetEditorBlocks,
  11706. updateEditorSettings: updateEditorSettings,
  11707. resetEditorBlocksWithoutUndoLevel: function resetEditorBlocksWithoutUndoLevel(blocks) {
  11708. resetEditorBlocks(blocks, {
  11709. __unstableShouldCreateUndoLevel: false
  11710. });
  11711. },
  11712. tearDownEditor: __experimentalTearDownEditor,
  11713. uninstallBlock: uninstallBlock
  11714. };
  11715. })])(provider_EditorProvider));
  11716. // EXTERNAL MODULE: external {"this":["wp","serverSideRender"]}
  11717. var external_this_wp_serverSideRender_ = __webpack_require__(58);
  11718. var external_this_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_serverSideRender_);
  11719. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js
  11720. // Block Creation Components
  11721. /**
  11722. * WordPress dependencies
  11723. */
  11724. function deprecateComponent(name, Wrapped) {
  11725. var staticsToHoist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  11726. var Component = Object(external_this_wp_element_["forwardRef"])(function (props, ref) {
  11727. external_this_wp_deprecated_default()('wp.editor.' + name, {
  11728. alternative: 'wp.blockEditor.' + name
  11729. });
  11730. return Object(external_this_wp_element_["createElement"])(Wrapped, Object(esm_extends["a" /* default */])({
  11731. ref: ref
  11732. }, props));
  11733. });
  11734. staticsToHoist.forEach(function (staticName) {
  11735. Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]);
  11736. });
  11737. return Component;
  11738. }
  11739. function deprecateFunction(name, func) {
  11740. return function () {
  11741. external_this_wp_deprecated_default()('wp.editor.' + name, {
  11742. alternative: 'wp.blockEditor.' + name
  11743. });
  11744. return func.apply(void 0, arguments);
  11745. };
  11746. }
  11747. var RichText = deprecateComponent('RichText', external_this_wp_blockEditor_["RichText"], ['Content']);
  11748. RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_this_wp_blockEditor_["RichText"].isEmpty);
  11749. var Autocomplete = deprecateComponent('Autocomplete', external_this_wp_blockEditor_["Autocomplete"]);
  11750. var AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_this_wp_blockEditor_["AlignmentToolbar"]);
  11751. var BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_this_wp_blockEditor_["BlockAlignmentToolbar"]);
  11752. var BlockControls = deprecateComponent('BlockControls', external_this_wp_blockEditor_["BlockControls"], ['Slot']);
  11753. var BlockEdit = deprecateComponent('BlockEdit', external_this_wp_blockEditor_["BlockEdit"]);
  11754. var BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"]);
  11755. var BlockFormatControls = deprecateComponent('BlockFormatControls', external_this_wp_blockEditor_["BlockFormatControls"], ['Slot']);
  11756. var BlockIcon = deprecateComponent('BlockIcon', external_this_wp_blockEditor_["BlockIcon"]);
  11757. var BlockInspector = deprecateComponent('BlockInspector', external_this_wp_blockEditor_["BlockInspector"]);
  11758. var BlockList = deprecateComponent('BlockList', external_this_wp_blockEditor_["BlockList"]);
  11759. var BlockMover = deprecateComponent('BlockMover', external_this_wp_blockEditor_["BlockMover"]);
  11760. var BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_this_wp_blockEditor_["BlockNavigationDropdown"]);
  11761. var BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_this_wp_blockEditor_["BlockSelectionClearer"]);
  11762. var BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_this_wp_blockEditor_["BlockSettingsMenu"]);
  11763. var BlockTitle = deprecateComponent('BlockTitle', external_this_wp_blockEditor_["BlockTitle"]);
  11764. var BlockToolbar = deprecateComponent('BlockToolbar', external_this_wp_blockEditor_["BlockToolbar"]);
  11765. var ColorPalette = deprecateComponent('ColorPalette', external_this_wp_blockEditor_["ColorPalette"]);
  11766. var ContrastChecker = deprecateComponent('ContrastChecker', external_this_wp_blockEditor_["ContrastChecker"]);
  11767. var CopyHandler = deprecateComponent('CopyHandler', external_this_wp_blockEditor_["CopyHandler"]);
  11768. var DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_this_wp_blockEditor_["DefaultBlockAppender"]);
  11769. var FontSizePicker = deprecateComponent('FontSizePicker', external_this_wp_blockEditor_["FontSizePicker"]);
  11770. var Inserter = deprecateComponent('Inserter', external_this_wp_blockEditor_["Inserter"]);
  11771. var InnerBlocks = deprecateComponent('InnerBlocks', external_this_wp_blockEditor_["InnerBlocks"], ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']);
  11772. var InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_this_wp_blockEditor_["InspectorAdvancedControls"], ['Slot']);
  11773. var InspectorControls = deprecateComponent('InspectorControls', external_this_wp_blockEditor_["InspectorControls"], ['Slot']);
  11774. var PanelColorSettings = deprecateComponent('PanelColorSettings', external_this_wp_blockEditor_["PanelColorSettings"]);
  11775. var PlainText = deprecateComponent('PlainText', external_this_wp_blockEditor_["PlainText"]);
  11776. var RichTextShortcut = deprecateComponent('RichTextShortcut', external_this_wp_blockEditor_["RichTextShortcut"]);
  11777. var RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_this_wp_blockEditor_["RichTextToolbarButton"]);
  11778. var __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_this_wp_blockEditor_["__unstableRichTextInputEvent"]);
  11779. var MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_this_wp_blockEditor_["MediaPlaceholder"]);
  11780. var MediaUpload = deprecateComponent('MediaUpload', external_this_wp_blockEditor_["MediaUpload"]);
  11781. var MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_this_wp_blockEditor_["MediaUploadCheck"]);
  11782. var MultiBlocksSwitcher = deprecateComponent('MultiBlocksSwitcher', external_this_wp_blockEditor_["MultiBlocksSwitcher"]);
  11783. var MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_this_wp_blockEditor_["MultiSelectScrollIntoView"]);
  11784. var NavigableToolbar = deprecateComponent('NavigableToolbar', external_this_wp_blockEditor_["NavigableToolbar"]);
  11785. var ObserveTyping = deprecateComponent('ObserveTyping', external_this_wp_blockEditor_["ObserveTyping"]);
  11786. var PreserveScrollInReorder = deprecateComponent('PreserveScrollInReorder', external_this_wp_blockEditor_["PreserveScrollInReorder"]);
  11787. var SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_this_wp_blockEditor_["SkipToSelectedBlock"]);
  11788. var URLInput = deprecateComponent('URLInput', external_this_wp_blockEditor_["URLInput"]);
  11789. var URLInputButton = deprecateComponent('URLInputButton', external_this_wp_blockEditor_["URLInputButton"]);
  11790. var URLPopover = deprecateComponent('URLPopover', external_this_wp_blockEditor_["URLPopover"]);
  11791. var Warning = deprecateComponent('Warning', external_this_wp_blockEditor_["Warning"]);
  11792. var WritingFlow = deprecateComponent('WritingFlow', external_this_wp_blockEditor_["WritingFlow"]);
  11793. var createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_this_wp_blockEditor_["createCustomColorsHOC"]);
  11794. var getColorClassName = deprecateFunction('getColorClassName', external_this_wp_blockEditor_["getColorClassName"]);
  11795. var getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_this_wp_blockEditor_["getColorObjectByAttributeValues"]);
  11796. var getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_this_wp_blockEditor_["getColorObjectByColorValue"]);
  11797. var getFontSize = deprecateFunction('getFontSize', external_this_wp_blockEditor_["getFontSize"]);
  11798. var getFontSizeClass = deprecateFunction('getFontSizeClass', external_this_wp_blockEditor_["getFontSizeClass"]);
  11799. var withColorContext = deprecateFunction('withColorContext', external_this_wp_blockEditor_["withColorContext"]);
  11800. var withColors = deprecateFunction('withColors', external_this_wp_blockEditor_["withColors"]);
  11801. var withFontSizes = deprecateFunction('withFontSizes', external_this_wp_blockEditor_["withFontSizes"]);
  11802. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js
  11803. // Block Creation Components
  11804. // Post Related Components
  11805. // State Related Components
  11806. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js
  11807. /**
  11808. * External dependencies
  11809. */
  11810. /**
  11811. * WordPress dependencies
  11812. */
  11813. /**
  11814. * Internal dependencies
  11815. */
  11816. function setDefaultCompleters() {
  11817. var completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  11818. var blockName = arguments.length > 1 ? arguments[1] : undefined;
  11819. // Provide copies so filters may directly modify them.
  11820. completers.push(Object(external_lodash_["clone"])(autocompleters_user)); // Add blocks autocompleter for Paragraph block
  11821. if (blockName === Object(external_this_wp_blocks_["getDefaultBlockName"])()) {
  11822. completers.push(Object(external_lodash_["clone"])(autocompleters_block));
  11823. }
  11824. return completers;
  11825. }
  11826. Object(external_this_wp_hooks_["addFilter"])('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters);
  11827. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js
  11828. /**
  11829. * Internal dependencies
  11830. */
  11831. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js
  11832. /* concated harmony reexport AutosaveMonitor */__webpack_require__.d(__webpack_exports__, "AutosaveMonitor", function() { return autosave_monitor; });
  11833. /* concated harmony reexport DocumentOutline */__webpack_require__.d(__webpack_exports__, "DocumentOutline", function() { return document_outline; });
  11834. /* concated harmony reexport DocumentOutlineCheck */__webpack_require__.d(__webpack_exports__, "DocumentOutlineCheck", function() { return check; });
  11835. /* concated harmony reexport VisualEditorGlobalKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "VisualEditorGlobalKeyboardShortcuts", function() { return visual_editor_shortcuts; });
  11836. /* concated harmony reexport EditorGlobalKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "EditorGlobalKeyboardShortcuts", function() { return EditorGlobalKeyboardShortcuts; });
  11837. /* concated harmony reexport TextEditorGlobalKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "TextEditorGlobalKeyboardShortcuts", function() { return TextEditorGlobalKeyboardShortcuts; });
  11838. /* concated harmony reexport EditorHistoryRedo */__webpack_require__.d(__webpack_exports__, "EditorHistoryRedo", function() { return editor_history_redo; });
  11839. /* concated harmony reexport EditorHistoryUndo */__webpack_require__.d(__webpack_exports__, "EditorHistoryUndo", function() { return editor_history_undo; });
  11840. /* concated harmony reexport EditorNotices */__webpack_require__.d(__webpack_exports__, "EditorNotices", function() { return editor_notices; });
  11841. /* concated harmony reexport ErrorBoundary */__webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return error_boundary; });
  11842. /* concated harmony reexport LocalAutosaveMonitor */__webpack_require__.d(__webpack_exports__, "LocalAutosaveMonitor", function() { return local_autosave_monitor; });
  11843. /* concated harmony reexport PageAttributesCheck */__webpack_require__.d(__webpack_exports__, "PageAttributesCheck", function() { return page_attributes_check; });
  11844. /* concated harmony reexport PageAttributesOrder */__webpack_require__.d(__webpack_exports__, "PageAttributesOrder", function() { return page_attributes_order; });
  11845. /* concated harmony reexport PageAttributesParent */__webpack_require__.d(__webpack_exports__, "PageAttributesParent", function() { return page_attributes_parent; });
  11846. /* concated harmony reexport PageTemplate */__webpack_require__.d(__webpack_exports__, "PageTemplate", function() { return page_attributes_template; });
  11847. /* concated harmony reexport PostAuthor */__webpack_require__.d(__webpack_exports__, "PostAuthor", function() { return post_author; });
  11848. /* concated harmony reexport PostAuthorCheck */__webpack_require__.d(__webpack_exports__, "PostAuthorCheck", function() { return post_author_check; });
  11849. /* concated harmony reexport PostComments */__webpack_require__.d(__webpack_exports__, "PostComments", function() { return post_comments; });
  11850. /* concated harmony reexport PostExcerpt */__webpack_require__.d(__webpack_exports__, "PostExcerpt", function() { return post_excerpt; });
  11851. /* concated harmony reexport PostExcerptCheck */__webpack_require__.d(__webpack_exports__, "PostExcerptCheck", function() { return post_excerpt_check; });
  11852. /* concated harmony reexport PostFeaturedImage */__webpack_require__.d(__webpack_exports__, "PostFeaturedImage", function() { return post_featured_image; });
  11853. /* concated harmony reexport PostFeaturedImageCheck */__webpack_require__.d(__webpack_exports__, "PostFeaturedImageCheck", function() { return post_featured_image_check; });
  11854. /* concated harmony reexport PostFormat */__webpack_require__.d(__webpack_exports__, "PostFormat", function() { return post_format; });
  11855. /* concated harmony reexport PostFormatCheck */__webpack_require__.d(__webpack_exports__, "PostFormatCheck", function() { return post_format_check; });
  11856. /* concated harmony reexport PostLastRevision */__webpack_require__.d(__webpack_exports__, "PostLastRevision", function() { return post_last_revision; });
  11857. /* concated harmony reexport PostLastRevisionCheck */__webpack_require__.d(__webpack_exports__, "PostLastRevisionCheck", function() { return post_last_revision_check; });
  11858. /* concated harmony reexport PostLockedModal */__webpack_require__.d(__webpack_exports__, "PostLockedModal", function() { return post_locked_modal; });
  11859. /* concated harmony reexport PostPendingStatus */__webpack_require__.d(__webpack_exports__, "PostPendingStatus", function() { return post_pending_status; });
  11860. /* concated harmony reexport PostPendingStatusCheck */__webpack_require__.d(__webpack_exports__, "PostPendingStatusCheck", function() { return post_pending_status_check; });
  11861. /* concated harmony reexport PostPingbacks */__webpack_require__.d(__webpack_exports__, "PostPingbacks", function() { return post_pingbacks; });
  11862. /* concated harmony reexport PostPreviewButton */__webpack_require__.d(__webpack_exports__, "PostPreviewButton", function() { return post_preview_button; });
  11863. /* concated harmony reexport PostPublishButton */__webpack_require__.d(__webpack_exports__, "PostPublishButton", function() { return post_publish_button; });
  11864. /* concated harmony reexport PostPublishButtonLabel */__webpack_require__.d(__webpack_exports__, "PostPublishButtonLabel", function() { return post_publish_button_label; });
  11865. /* concated harmony reexport PostPublishPanel */__webpack_require__.d(__webpack_exports__, "PostPublishPanel", function() { return post_publish_panel; });
  11866. /* concated harmony reexport PostSavedState */__webpack_require__.d(__webpack_exports__, "PostSavedState", function() { return post_saved_state; });
  11867. /* concated harmony reexport PostSchedule */__webpack_require__.d(__webpack_exports__, "PostSchedule", function() { return post_schedule; });
  11868. /* concated harmony reexport PostScheduleCheck */__webpack_require__.d(__webpack_exports__, "PostScheduleCheck", function() { return post_schedule_check; });
  11869. /* concated harmony reexport PostScheduleLabel */__webpack_require__.d(__webpack_exports__, "PostScheduleLabel", function() { return post_schedule_label; });
  11870. /* concated harmony reexport PostSticky */__webpack_require__.d(__webpack_exports__, "PostSticky", function() { return post_sticky; });
  11871. /* concated harmony reexport PostStickyCheck */__webpack_require__.d(__webpack_exports__, "PostStickyCheck", function() { return post_sticky_check; });
  11872. /* concated harmony reexport PostSwitchToDraftButton */__webpack_require__.d(__webpack_exports__, "PostSwitchToDraftButton", function() { return post_switch_to_draft_button; });
  11873. /* concated harmony reexport PostTaxonomies */__webpack_require__.d(__webpack_exports__, "PostTaxonomies", function() { return post_taxonomies; });
  11874. /* concated harmony reexport PostTaxonomiesCheck */__webpack_require__.d(__webpack_exports__, "PostTaxonomiesCheck", function() { return post_taxonomies_check; });
  11875. /* concated harmony reexport PostTextEditor */__webpack_require__.d(__webpack_exports__, "PostTextEditor", function() { return post_text_editor; });
  11876. /* concated harmony reexport PostTitle */__webpack_require__.d(__webpack_exports__, "PostTitle", function() { return post_title; });
  11877. /* concated harmony reexport PostTrash */__webpack_require__.d(__webpack_exports__, "PostTrash", function() { return post_trash; });
  11878. /* concated harmony reexport PostTrashCheck */__webpack_require__.d(__webpack_exports__, "PostTrashCheck", function() { return post_trash_check; });
  11879. /* concated harmony reexport PostTypeSupportCheck */__webpack_require__.d(__webpack_exports__, "PostTypeSupportCheck", function() { return post_type_support_check; });
  11880. /* concated harmony reexport PostVisibility */__webpack_require__.d(__webpack_exports__, "PostVisibility", function() { return post_visibility; });
  11881. /* concated harmony reexport PostVisibilityLabel */__webpack_require__.d(__webpack_exports__, "PostVisibilityLabel", function() { return post_visibility_label; });
  11882. /* concated harmony reexport PostVisibilityCheck */__webpack_require__.d(__webpack_exports__, "PostVisibilityCheck", function() { return post_visibility_check; });
  11883. /* concated harmony reexport TableOfContents */__webpack_require__.d(__webpack_exports__, "TableOfContents", function() { return table_of_contents; });
  11884. /* concated harmony reexport UnsavedChangesWarning */__webpack_require__.d(__webpack_exports__, "UnsavedChangesWarning", function() { return unsaved_changes_warning; });
  11885. /* concated harmony reexport WordCount */__webpack_require__.d(__webpack_exports__, "WordCount", function() { return word_count; });
  11886. /* concated harmony reexport EditorProvider */__webpack_require__.d(__webpack_exports__, "EditorProvider", function() { return provider; });
  11887. /* concated harmony reexport blockAutocompleter */__webpack_require__.d(__webpack_exports__, "blockAutocompleter", function() { return autocompleters_block; });
  11888. /* concated harmony reexport userAutocompleter */__webpack_require__.d(__webpack_exports__, "userAutocompleter", function() { return autocompleters_user; });
  11889. /* concated harmony reexport ServerSideRender */__webpack_require__.d(__webpack_exports__, "ServerSideRender", function() { return external_this_wp_serverSideRender_default.a; });
  11890. /* concated harmony reexport RichText */__webpack_require__.d(__webpack_exports__, "RichText", function() { return RichText; });
  11891. /* concated harmony reexport Autocomplete */__webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return Autocomplete; });
  11892. /* concated harmony reexport AlignmentToolbar */__webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return AlignmentToolbar; });
  11893. /* concated harmony reexport BlockAlignmentToolbar */__webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return BlockAlignmentToolbar; });
  11894. /* concated harmony reexport BlockControls */__webpack_require__.d(__webpack_exports__, "BlockControls", function() { return BlockControls; });
  11895. /* concated harmony reexport BlockEdit */__webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return BlockEdit; });
  11896. /* concated harmony reexport BlockEditorKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return BlockEditorKeyboardShortcuts; });
  11897. /* concated harmony reexport BlockFormatControls */__webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return BlockFormatControls; });
  11898. /* concated harmony reexport BlockIcon */__webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return BlockIcon; });
  11899. /* concated harmony reexport BlockInspector */__webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return BlockInspector; });
  11900. /* concated harmony reexport BlockList */__webpack_require__.d(__webpack_exports__, "BlockList", function() { return BlockList; });
  11901. /* concated harmony reexport BlockMover */__webpack_require__.d(__webpack_exports__, "BlockMover", function() { return BlockMover; });
  11902. /* concated harmony reexport BlockNavigationDropdown */__webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return BlockNavigationDropdown; });
  11903. /* concated harmony reexport BlockSelectionClearer */__webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return BlockSelectionClearer; });
  11904. /* concated harmony reexport BlockSettingsMenu */__webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return BlockSettingsMenu; });
  11905. /* concated harmony reexport BlockTitle */__webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return BlockTitle; });
  11906. /* concated harmony reexport BlockToolbar */__webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return BlockToolbar; });
  11907. /* concated harmony reexport ColorPalette */__webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return ColorPalette; });
  11908. /* concated harmony reexport ContrastChecker */__webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return ContrastChecker; });
  11909. /* concated harmony reexport CopyHandler */__webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return CopyHandler; });
  11910. /* concated harmony reexport DefaultBlockAppender */__webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return DefaultBlockAppender; });
  11911. /* concated harmony reexport FontSizePicker */__webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return FontSizePicker; });
  11912. /* concated harmony reexport Inserter */__webpack_require__.d(__webpack_exports__, "Inserter", function() { return Inserter; });
  11913. /* concated harmony reexport InnerBlocks */__webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return InnerBlocks; });
  11914. /* concated harmony reexport InspectorAdvancedControls */__webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return InspectorAdvancedControls; });
  11915. /* concated harmony reexport InspectorControls */__webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return InspectorControls; });
  11916. /* concated harmony reexport PanelColorSettings */__webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return PanelColorSettings; });
  11917. /* concated harmony reexport PlainText */__webpack_require__.d(__webpack_exports__, "PlainText", function() { return PlainText; });
  11918. /* concated harmony reexport RichTextShortcut */__webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return RichTextShortcut; });
  11919. /* concated harmony reexport RichTextToolbarButton */__webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return RichTextToolbarButton; });
  11920. /* concated harmony reexport __unstableRichTextInputEvent */__webpack_require__.d(__webpack_exports__, "__unstableRichTextInputEvent", function() { return __unstableRichTextInputEvent; });
  11921. /* concated harmony reexport MediaPlaceholder */__webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return MediaPlaceholder; });
  11922. /* concated harmony reexport MediaUpload */__webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return MediaUpload; });
  11923. /* concated harmony reexport MediaUploadCheck */__webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return MediaUploadCheck; });
  11924. /* concated harmony reexport MultiBlocksSwitcher */__webpack_require__.d(__webpack_exports__, "MultiBlocksSwitcher", function() { return MultiBlocksSwitcher; });
  11925. /* concated harmony reexport MultiSelectScrollIntoView */__webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return MultiSelectScrollIntoView; });
  11926. /* concated harmony reexport NavigableToolbar */__webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return NavigableToolbar; });
  11927. /* concated harmony reexport ObserveTyping */__webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return ObserveTyping; });
  11928. /* concated harmony reexport PreserveScrollInReorder */__webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return PreserveScrollInReorder; });
  11929. /* concated harmony reexport SkipToSelectedBlock */__webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return SkipToSelectedBlock; });
  11930. /* concated harmony reexport URLInput */__webpack_require__.d(__webpack_exports__, "URLInput", function() { return URLInput; });
  11931. /* concated harmony reexport URLInputButton */__webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return URLInputButton; });
  11932. /* concated harmony reexport URLPopover */__webpack_require__.d(__webpack_exports__, "URLPopover", function() { return URLPopover; });
  11933. /* concated harmony reexport Warning */__webpack_require__.d(__webpack_exports__, "Warning", function() { return Warning; });
  11934. /* concated harmony reexport WritingFlow */__webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return WritingFlow; });
  11935. /* concated harmony reexport createCustomColorsHOC */__webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return createCustomColorsHOC; });
  11936. /* concated harmony reexport getColorClassName */__webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return getColorClassName; });
  11937. /* concated harmony reexport getColorObjectByAttributeValues */__webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return getColorObjectByAttributeValues; });
  11938. /* concated harmony reexport getColorObjectByColorValue */__webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return getColorObjectByColorValue; });
  11939. /* concated harmony reexport getFontSize */__webpack_require__.d(__webpack_exports__, "getFontSize", function() { return getFontSize; });
  11940. /* concated harmony reexport getFontSizeClass */__webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return getFontSizeClass; });
  11941. /* concated harmony reexport withColorContext */__webpack_require__.d(__webpack_exports__, "withColorContext", function() { return withColorContext; });
  11942. /* concated harmony reexport withColors */__webpack_require__.d(__webpack_exports__, "withColors", function() { return withColors; });
  11943. /* concated harmony reexport withFontSizes */__webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return withFontSizes; });
  11944. /* concated harmony reexport mediaUpload */__webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return media_upload; });
  11945. /* concated harmony reexport cleanForSlug */__webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return cleanForSlug; });
  11946. /* concated harmony reexport storeConfig */__webpack_require__.d(__webpack_exports__, "storeConfig", function() { return storeConfig; });
  11947. /* concated harmony reexport transformStyles */__webpack_require__.d(__webpack_exports__, "transformStyles", function() { return external_this_wp_blockEditor_["transformStyles"]; });
  11948. /**
  11949. * WordPress dependencies
  11950. */
  11951. /**
  11952. * Internal dependencies
  11953. */
  11954. /*
  11955. * Backward compatibility
  11956. */
  11957. /***/ }),
  11958. /***/ 36:
  11959. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  11960. "use strict";
  11961. var LEAF_KEY, hasWeakMap;
  11962. /**
  11963. * Arbitrary value used as key for referencing cache object in WeakMap tree.
  11964. *
  11965. * @type {Object}
  11966. */
  11967. LEAF_KEY = {};
  11968. /**
  11969. * Whether environment supports WeakMap.
  11970. *
  11971. * @type {boolean}
  11972. */
  11973. hasWeakMap = typeof WeakMap !== 'undefined';
  11974. /**
  11975. * Returns the first argument as the sole entry in an array.
  11976. *
  11977. * @param {*} value Value to return.
  11978. *
  11979. * @return {Array} Value returned as entry in array.
  11980. */
  11981. function arrayOf( value ) {
  11982. return [ value ];
  11983. }
  11984. /**
  11985. * Returns true if the value passed is object-like, or false otherwise. A value
  11986. * is object-like if it can support property assignment, e.g. object or array.
  11987. *
  11988. * @param {*} value Value to test.
  11989. *
  11990. * @return {boolean} Whether value is object-like.
  11991. */
  11992. function isObjectLike( value ) {
  11993. return !! value && 'object' === typeof value;
  11994. }
  11995. /**
  11996. * Creates and returns a new cache object.
  11997. *
  11998. * @return {Object} Cache object.
  11999. */
  12000. function createCache() {
  12001. var cache = {
  12002. clear: function() {
  12003. cache.head = null;
  12004. },
  12005. };
  12006. return cache;
  12007. }
  12008. /**
  12009. * Returns true if entries within the two arrays are strictly equal by
  12010. * reference from a starting index.
  12011. *
  12012. * @param {Array} a First array.
  12013. * @param {Array} b Second array.
  12014. * @param {number} fromIndex Index from which to start comparison.
  12015. *
  12016. * @return {boolean} Whether arrays are shallowly equal.
  12017. */
  12018. function isShallowEqual( a, b, fromIndex ) {
  12019. var i;
  12020. if ( a.length !== b.length ) {
  12021. return false;
  12022. }
  12023. for ( i = fromIndex; i < a.length; i++ ) {
  12024. if ( a[ i ] !== b[ i ] ) {
  12025. return false;
  12026. }
  12027. }
  12028. return true;
  12029. }
  12030. /**
  12031. * Returns a memoized selector function. The getDependants function argument is
  12032. * called before the memoized selector and is expected to return an immutable
  12033. * reference or array of references on which the selector depends for computing
  12034. * its own return value. The memoize cache is preserved only as long as those
  12035. * dependant references remain the same. If getDependants returns a different
  12036. * reference(s), the cache is cleared and the selector value regenerated.
  12037. *
  12038. * @param {Function} selector Selector function.
  12039. * @param {Function} getDependants Dependant getter returning an immutable
  12040. * reference or array of reference used in
  12041. * cache bust consideration.
  12042. *
  12043. * @return {Function} Memoized selector.
  12044. */
  12045. /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
  12046. var rootCache, getCache;
  12047. // Use object source as dependant if getter not provided
  12048. if ( ! getDependants ) {
  12049. getDependants = arrayOf;
  12050. }
  12051. /**
  12052. * Returns the root cache. If WeakMap is supported, this is assigned to the
  12053. * root WeakMap cache set, otherwise it is a shared instance of the default
  12054. * cache object.
  12055. *
  12056. * @return {(WeakMap|Object)} Root cache object.
  12057. */
  12058. function getRootCache() {
  12059. return rootCache;
  12060. }
  12061. /**
  12062. * Returns the cache for a given dependants array. When possible, a WeakMap
  12063. * will be used to create a unique cache for each set of dependants. This
  12064. * is feasible due to the nature of WeakMap in allowing garbage collection
  12065. * to occur on entries where the key object is no longer referenced. Since
  12066. * WeakMap requires the key to be an object, this is only possible when the
  12067. * dependant is object-like. The root cache is created as a hierarchy where
  12068. * each top-level key is the first entry in a dependants set, the value a
  12069. * WeakMap where each key is the next dependant, and so on. This continues
  12070. * so long as the dependants are object-like. If no dependants are object-
  12071. * like, then the cache is shared across all invocations.
  12072. *
  12073. * @see isObjectLike
  12074. *
  12075. * @param {Array} dependants Selector dependants.
  12076. *
  12077. * @return {Object} Cache object.
  12078. */
  12079. function getWeakMapCache( dependants ) {
  12080. var caches = rootCache,
  12081. isUniqueByDependants = true,
  12082. i, dependant, map, cache;
  12083. for ( i = 0; i < dependants.length; i++ ) {
  12084. dependant = dependants[ i ];
  12085. // Can only compose WeakMap from object-like key.
  12086. if ( ! isObjectLike( dependant ) ) {
  12087. isUniqueByDependants = false;
  12088. break;
  12089. }
  12090. // Does current segment of cache already have a WeakMap?
  12091. if ( caches.has( dependant ) ) {
  12092. // Traverse into nested WeakMap.
  12093. caches = caches.get( dependant );
  12094. } else {
  12095. // Create, set, and traverse into a new one.
  12096. map = new WeakMap();
  12097. caches.set( dependant, map );
  12098. caches = map;
  12099. }
  12100. }
  12101. // We use an arbitrary (but consistent) object as key for the last item
  12102. // in the WeakMap to serve as our running cache.
  12103. if ( ! caches.has( LEAF_KEY ) ) {
  12104. cache = createCache();
  12105. cache.isUniqueByDependants = isUniqueByDependants;
  12106. caches.set( LEAF_KEY, cache );
  12107. }
  12108. return caches.get( LEAF_KEY );
  12109. }
  12110. // Assign cache handler by availability of WeakMap
  12111. getCache = hasWeakMap ? getWeakMapCache : getRootCache;
  12112. /**
  12113. * Resets root memoization cache.
  12114. */
  12115. function clear() {
  12116. rootCache = hasWeakMap ? new WeakMap() : createCache();
  12117. }
  12118. // eslint-disable-next-line jsdoc/check-param-names
  12119. /**
  12120. * The augmented selector call, considering first whether dependants have
  12121. * changed before passing it to underlying memoize function.
  12122. *
  12123. * @param {Object} source Source object for derivation.
  12124. * @param {...*} extraArgs Additional arguments to pass to selector.
  12125. *
  12126. * @return {*} Selector result.
  12127. */
  12128. function callSelector( /* source, ...extraArgs */ ) {
  12129. var len = arguments.length,
  12130. cache, node, i, args, dependants;
  12131. // Create copy of arguments (avoid leaking deoptimization).
  12132. args = new Array( len );
  12133. for ( i = 0; i < len; i++ ) {
  12134. args[ i ] = arguments[ i ];
  12135. }
  12136. dependants = getDependants.apply( null, args );
  12137. cache = getCache( dependants );
  12138. // If not guaranteed uniqueness by dependants (primitive type or lack
  12139. // of WeakMap support), shallow compare against last dependants and, if
  12140. // references have changed, destroy cache to recalculate result.
  12141. if ( ! cache.isUniqueByDependants ) {
  12142. if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
  12143. cache.clear();
  12144. }
  12145. cache.lastDependants = dependants;
  12146. }
  12147. node = cache.head;
  12148. while ( node ) {
  12149. // Check whether node arguments match arguments
  12150. if ( ! isShallowEqual( node.args, args, 1 ) ) {
  12151. node = node.next;
  12152. continue;
  12153. }
  12154. // At this point we can assume we've found a match
  12155. // Surface matched node to head if not already
  12156. if ( node !== cache.head ) {
  12157. // Adjust siblings to point to each other.
  12158. node.prev.next = node.next;
  12159. if ( node.next ) {
  12160. node.next.prev = node.prev;
  12161. }
  12162. node.next = cache.head;
  12163. node.prev = null;
  12164. cache.head.prev = node;
  12165. cache.head = node;
  12166. }
  12167. // Return immediately
  12168. return node.val;
  12169. }
  12170. // No cached value found. Continue to insertion phase:
  12171. node = {
  12172. // Generate the result from original function
  12173. val: selector.apply( null, args ),
  12174. };
  12175. // Avoid including the source object in the cache.
  12176. args[ 0 ] = null;
  12177. node.args = args;
  12178. // Don't need to check whether node is already head, since it would
  12179. // have been returned above already if it was
  12180. // Shift existing head down list
  12181. if ( cache.head ) {
  12182. cache.head.prev = node;
  12183. node.next = cache.head;
  12184. }
  12185. cache.head = node;
  12186. return node.val;
  12187. }
  12188. callSelector.getDependants = getDependants;
  12189. callSelector.clear = clear;
  12190. clear();
  12191. return callSelector;
  12192. });
  12193. /***/ }),
  12194. /***/ 37:
  12195. /***/ (function(module, exports) {
  12196. (function() { module.exports = this["wp"]["deprecated"]; }());
  12197. /***/ }),
  12198. /***/ 38:
  12199. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  12200. "use strict";
  12201. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
  12202. function _arrayWithHoles(arr) {
  12203. if (Array.isArray(arr)) return arr;
  12204. }
  12205. /***/ }),
  12206. /***/ 39:
  12207. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  12208. "use strict";
  12209. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
  12210. function _nonIterableRest() {
  12211. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  12212. }
  12213. /***/ }),
  12214. /***/ 4:
  12215. /***/ (function(module, exports) {
  12216. (function() { module.exports = this["wp"]["data"]; }());
  12217. /***/ }),
  12218. /***/ 41:
  12219. /***/ (function(module, exports) {
  12220. (function() { module.exports = this["wp"]["isShallowEqual"]; }());
  12221. /***/ }),
  12222. /***/ 42:
  12223. /***/ (function(module, exports) {
  12224. (function() { module.exports = this["wp"]["viewport"]; }());
  12225. /***/ }),
  12226. /***/ 43:
  12227. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  12228. "use strict";
  12229. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; });
  12230. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  12231. try {
  12232. var info = gen[key](arg);
  12233. var value = info.value;
  12234. } catch (error) {
  12235. reject(error);
  12236. return;
  12237. }
  12238. if (info.done) {
  12239. resolve(value);
  12240. } else {
  12241. Promise.resolve(value).then(_next, _throw);
  12242. }
  12243. }
  12244. function _asyncToGenerator(fn) {
  12245. return function () {
  12246. var self = this,
  12247. args = arguments;
  12248. return new Promise(function (resolve, reject) {
  12249. var gen = fn.apply(self, args);
  12250. function _next(value) {
  12251. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  12252. }
  12253. function _throw(err) {
  12254. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  12255. }
  12256. _next(undefined);
  12257. });
  12258. };
  12259. }
  12260. /***/ }),
  12261. /***/ 44:
  12262. /***/ (function(module, exports, __webpack_require__) {
  12263. module.exports = function memize( fn, options ) {
  12264. var size = 0,
  12265. maxSize, head, tail;
  12266. if ( options && options.maxSize ) {
  12267. maxSize = options.maxSize;
  12268. }
  12269. function memoized( /* ...args */ ) {
  12270. var node = head,
  12271. len = arguments.length,
  12272. args, i;
  12273. searchCache: while ( node ) {
  12274. // Perform a shallow equality test to confirm that whether the node
  12275. // under test is a candidate for the arguments passed. Two arrays
  12276. // are shallowly equal if their length matches and each entry is
  12277. // strictly equal between the two sets. Avoid abstracting to a
  12278. // function which could incur an arguments leaking deoptimization.
  12279. // Check whether node arguments match arguments length
  12280. if ( node.args.length !== arguments.length ) {
  12281. node = node.next;
  12282. continue;
  12283. }
  12284. // Check whether node arguments match arguments values
  12285. for ( i = 0; i < len; i++ ) {
  12286. if ( node.args[ i ] !== arguments[ i ] ) {
  12287. node = node.next;
  12288. continue searchCache;
  12289. }
  12290. }
  12291. // At this point we can assume we've found a match
  12292. // Surface matched node to head if not already
  12293. if ( node !== head ) {
  12294. // As tail, shift to previous. Must only shift if not also
  12295. // head, since if both head and tail, there is no previous.
  12296. if ( node === tail ) {
  12297. tail = node.prev;
  12298. }
  12299. // Adjust siblings to point to each other. If node was tail,
  12300. // this also handles new tail's empty `next` assignment.
  12301. node.prev.next = node.next;
  12302. if ( node.next ) {
  12303. node.next.prev = node.prev;
  12304. }
  12305. node.next = head;
  12306. node.prev = null;
  12307. head.prev = node;
  12308. head = node;
  12309. }
  12310. // Return immediately
  12311. return node.val;
  12312. }
  12313. // No cached value found. Continue to insertion phase:
  12314. // Create a copy of arguments (avoid leaking deoptimization)
  12315. args = new Array( len );
  12316. for ( i = 0; i < len; i++ ) {
  12317. args[ i ] = arguments[ i ];
  12318. }
  12319. node = {
  12320. args: args,
  12321. // Generate the result from original function
  12322. val: fn.apply( null, args )
  12323. };
  12324. // Don't need to check whether node is already head, since it would
  12325. // have been returned above already if it was
  12326. // Shift existing head down list
  12327. if ( head ) {
  12328. head.prev = node;
  12329. node.next = head;
  12330. } else {
  12331. // If no head, follows that there's no tail (at initial or reset)
  12332. tail = node;
  12333. }
  12334. // Trim tail if we're reached max size and are pending cache insertion
  12335. if ( size === maxSize ) {
  12336. tail = tail.prev;
  12337. tail.next = null;
  12338. } else {
  12339. size++;
  12340. }
  12341. head = node;
  12342. return node.val;
  12343. }
  12344. memoized.clear = function() {
  12345. head = null;
  12346. tail = null;
  12347. size = 0;
  12348. };
  12349. if ( false ) {}
  12350. return memoized;
  12351. };
  12352. /***/ }),
  12353. /***/ 47:
  12354. /***/ (function(module, exports, __webpack_require__) {
  12355. /**
  12356. * Copyright (c) 2014-present, Facebook, Inc.
  12357. *
  12358. * This source code is licensed under the MIT license found in the
  12359. * LICENSE file in the root directory of this source tree.
  12360. */
  12361. var runtime = (function (exports) {
  12362. "use strict";
  12363. var Op = Object.prototype;
  12364. var hasOwn = Op.hasOwnProperty;
  12365. var undefined; // More compressible than void 0.
  12366. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  12367. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  12368. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  12369. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  12370. function wrap(innerFn, outerFn, self, tryLocsList) {
  12371. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  12372. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  12373. var generator = Object.create(protoGenerator.prototype);
  12374. var context = new Context(tryLocsList || []);
  12375. // The ._invoke method unifies the implementations of the .next,
  12376. // .throw, and .return methods.
  12377. generator._invoke = makeInvokeMethod(innerFn, self, context);
  12378. return generator;
  12379. }
  12380. exports.wrap = wrap;
  12381. // Try/catch helper to minimize deoptimizations. Returns a completion
  12382. // record like context.tryEntries[i].completion. This interface could
  12383. // have been (and was previously) designed to take a closure to be
  12384. // invoked without arguments, but in all the cases we care about we
  12385. // already have an existing method we want to call, so there's no need
  12386. // to create a new function object. We can even get away with assuming
  12387. // the method takes exactly one argument, since that happens to be true
  12388. // in every case, so we don't have to touch the arguments object. The
  12389. // only additional allocation required is the completion record, which
  12390. // has a stable shape and so hopefully should be cheap to allocate.
  12391. function tryCatch(fn, obj, arg) {
  12392. try {
  12393. return { type: "normal", arg: fn.call(obj, arg) };
  12394. } catch (err) {
  12395. return { type: "throw", arg: err };
  12396. }
  12397. }
  12398. var GenStateSuspendedStart = "suspendedStart";
  12399. var GenStateSuspendedYield = "suspendedYield";
  12400. var GenStateExecuting = "executing";
  12401. var GenStateCompleted = "completed";
  12402. // Returning this object from the innerFn has the same effect as
  12403. // breaking out of the dispatch switch statement.
  12404. var ContinueSentinel = {};
  12405. // Dummy constructor functions that we use as the .constructor and
  12406. // .constructor.prototype properties for functions that return Generator
  12407. // objects. For full spec compliance, you may wish to configure your
  12408. // minifier not to mangle the names of these two functions.
  12409. function Generator() {}
  12410. function GeneratorFunction() {}
  12411. function GeneratorFunctionPrototype() {}
  12412. // This is a polyfill for %IteratorPrototype% for environments that
  12413. // don't natively support it.
  12414. var IteratorPrototype = {};
  12415. IteratorPrototype[iteratorSymbol] = function () {
  12416. return this;
  12417. };
  12418. var getProto = Object.getPrototypeOf;
  12419. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  12420. if (NativeIteratorPrototype &&
  12421. NativeIteratorPrototype !== Op &&
  12422. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  12423. // This environment has a native %IteratorPrototype%; use it instead
  12424. // of the polyfill.
  12425. IteratorPrototype = NativeIteratorPrototype;
  12426. }
  12427. var Gp = GeneratorFunctionPrototype.prototype =
  12428. Generator.prototype = Object.create(IteratorPrototype);
  12429. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  12430. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  12431. GeneratorFunctionPrototype[toStringTagSymbol] =
  12432. GeneratorFunction.displayName = "GeneratorFunction";
  12433. // Helper for defining the .next, .throw, and .return methods of the
  12434. // Iterator interface in terms of a single ._invoke method.
  12435. function defineIteratorMethods(prototype) {
  12436. ["next", "throw", "return"].forEach(function(method) {
  12437. prototype[method] = function(arg) {
  12438. return this._invoke(method, arg);
  12439. };
  12440. });
  12441. }
  12442. exports.isGeneratorFunction = function(genFun) {
  12443. var ctor = typeof genFun === "function" && genFun.constructor;
  12444. return ctor
  12445. ? ctor === GeneratorFunction ||
  12446. // For the native GeneratorFunction constructor, the best we can
  12447. // do is to check its .name property.
  12448. (ctor.displayName || ctor.name) === "GeneratorFunction"
  12449. : false;
  12450. };
  12451. exports.mark = function(genFun) {
  12452. if (Object.setPrototypeOf) {
  12453. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  12454. } else {
  12455. genFun.__proto__ = GeneratorFunctionPrototype;
  12456. if (!(toStringTagSymbol in genFun)) {
  12457. genFun[toStringTagSymbol] = "GeneratorFunction";
  12458. }
  12459. }
  12460. genFun.prototype = Object.create(Gp);
  12461. return genFun;
  12462. };
  12463. // Within the body of any async function, `await x` is transformed to
  12464. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  12465. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  12466. // meant to be awaited.
  12467. exports.awrap = function(arg) {
  12468. return { __await: arg };
  12469. };
  12470. function AsyncIterator(generator) {
  12471. function invoke(method, arg, resolve, reject) {
  12472. var record = tryCatch(generator[method], generator, arg);
  12473. if (record.type === "throw") {
  12474. reject(record.arg);
  12475. } else {
  12476. var result = record.arg;
  12477. var value = result.value;
  12478. if (value &&
  12479. typeof value === "object" &&
  12480. hasOwn.call(value, "__await")) {
  12481. return Promise.resolve(value.__await).then(function(value) {
  12482. invoke("next", value, resolve, reject);
  12483. }, function(err) {
  12484. invoke("throw", err, resolve, reject);
  12485. });
  12486. }
  12487. return Promise.resolve(value).then(function(unwrapped) {
  12488. // When a yielded Promise is resolved, its final value becomes
  12489. // the .value of the Promise<{value,done}> result for the
  12490. // current iteration.
  12491. result.value = unwrapped;
  12492. resolve(result);
  12493. }, function(error) {
  12494. // If a rejected Promise was yielded, throw the rejection back
  12495. // into the async generator function so it can be handled there.
  12496. return invoke("throw", error, resolve, reject);
  12497. });
  12498. }
  12499. }
  12500. var previousPromise;
  12501. function enqueue(method, arg) {
  12502. function callInvokeWithMethodAndArg() {
  12503. return new Promise(function(resolve, reject) {
  12504. invoke(method, arg, resolve, reject);
  12505. });
  12506. }
  12507. return previousPromise =
  12508. // If enqueue has been called before, then we want to wait until
  12509. // all previous Promises have been resolved before calling invoke,
  12510. // so that results are always delivered in the correct order. If
  12511. // enqueue has not been called before, then it is important to
  12512. // call invoke immediately, without waiting on a callback to fire,
  12513. // so that the async generator function has the opportunity to do
  12514. // any necessary setup in a predictable way. This predictability
  12515. // is why the Promise constructor synchronously invokes its
  12516. // executor callback, and why async functions synchronously
  12517. // execute code before the first await. Since we implement simple
  12518. // async functions in terms of async generators, it is especially
  12519. // important to get this right, even though it requires care.
  12520. previousPromise ? previousPromise.then(
  12521. callInvokeWithMethodAndArg,
  12522. // Avoid propagating failures to Promises returned by later
  12523. // invocations of the iterator.
  12524. callInvokeWithMethodAndArg
  12525. ) : callInvokeWithMethodAndArg();
  12526. }
  12527. // Define the unified helper method that is used to implement .next,
  12528. // .throw, and .return (see defineIteratorMethods).
  12529. this._invoke = enqueue;
  12530. }
  12531. defineIteratorMethods(AsyncIterator.prototype);
  12532. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  12533. return this;
  12534. };
  12535. exports.AsyncIterator = AsyncIterator;
  12536. // Note that simple async functions are implemented on top of
  12537. // AsyncIterator objects; they just return a Promise for the value of
  12538. // the final result produced by the iterator.
  12539. exports.async = function(innerFn, outerFn, self, tryLocsList) {
  12540. var iter = new AsyncIterator(
  12541. wrap(innerFn, outerFn, self, tryLocsList)
  12542. );
  12543. return exports.isGeneratorFunction(outerFn)
  12544. ? iter // If outerFn is a generator, return the full iterator.
  12545. : iter.next().then(function(result) {
  12546. return result.done ? result.value : iter.next();
  12547. });
  12548. };
  12549. function makeInvokeMethod(innerFn, self, context) {
  12550. var state = GenStateSuspendedStart;
  12551. return function invoke(method, arg) {
  12552. if (state === GenStateExecuting) {
  12553. throw new Error("Generator is already running");
  12554. }
  12555. if (state === GenStateCompleted) {
  12556. if (method === "throw") {
  12557. throw arg;
  12558. }
  12559. // Be forgiving, per 25.3.3.3.3 of the spec:
  12560. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  12561. return doneResult();
  12562. }
  12563. context.method = method;
  12564. context.arg = arg;
  12565. while (true) {
  12566. var delegate = context.delegate;
  12567. if (delegate) {
  12568. var delegateResult = maybeInvokeDelegate(delegate, context);
  12569. if (delegateResult) {
  12570. if (delegateResult === ContinueSentinel) continue;
  12571. return delegateResult;
  12572. }
  12573. }
  12574. if (context.method === "next") {
  12575. // Setting context._sent for legacy support of Babel's
  12576. // function.sent implementation.
  12577. context.sent = context._sent = context.arg;
  12578. } else if (context.method === "throw") {
  12579. if (state === GenStateSuspendedStart) {
  12580. state = GenStateCompleted;
  12581. throw context.arg;
  12582. }
  12583. context.dispatchException(context.arg);
  12584. } else if (context.method === "return") {
  12585. context.abrupt("return", context.arg);
  12586. }
  12587. state = GenStateExecuting;
  12588. var record = tryCatch(innerFn, self, context);
  12589. if (record.type === "normal") {
  12590. // If an exception is thrown from innerFn, we leave state ===
  12591. // GenStateExecuting and loop back for another invocation.
  12592. state = context.done
  12593. ? GenStateCompleted
  12594. : GenStateSuspendedYield;
  12595. if (record.arg === ContinueSentinel) {
  12596. continue;
  12597. }
  12598. return {
  12599. value: record.arg,
  12600. done: context.done
  12601. };
  12602. } else if (record.type === "throw") {
  12603. state = GenStateCompleted;
  12604. // Dispatch the exception by looping back around to the
  12605. // context.dispatchException(context.arg) call above.
  12606. context.method = "throw";
  12607. context.arg = record.arg;
  12608. }
  12609. }
  12610. };
  12611. }
  12612. // Call delegate.iterator[context.method](context.arg) and handle the
  12613. // result, either by returning a { value, done } result from the
  12614. // delegate iterator, or by modifying context.method and context.arg,
  12615. // setting context.delegate to null, and returning the ContinueSentinel.
  12616. function maybeInvokeDelegate(delegate, context) {
  12617. var method = delegate.iterator[context.method];
  12618. if (method === undefined) {
  12619. // A .throw or .return when the delegate iterator has no .throw
  12620. // method always terminates the yield* loop.
  12621. context.delegate = null;
  12622. if (context.method === "throw") {
  12623. // Note: ["return"] must be used for ES3 parsing compatibility.
  12624. if (delegate.iterator["return"]) {
  12625. // If the delegate iterator has a return method, give it a
  12626. // chance to clean up.
  12627. context.method = "return";
  12628. context.arg = undefined;
  12629. maybeInvokeDelegate(delegate, context);
  12630. if (context.method === "throw") {
  12631. // If maybeInvokeDelegate(context) changed context.method from
  12632. // "return" to "throw", let that override the TypeError below.
  12633. return ContinueSentinel;
  12634. }
  12635. }
  12636. context.method = "throw";
  12637. context.arg = new TypeError(
  12638. "The iterator does not provide a 'throw' method");
  12639. }
  12640. return ContinueSentinel;
  12641. }
  12642. var record = tryCatch(method, delegate.iterator, context.arg);
  12643. if (record.type === "throw") {
  12644. context.method = "throw";
  12645. context.arg = record.arg;
  12646. context.delegate = null;
  12647. return ContinueSentinel;
  12648. }
  12649. var info = record.arg;
  12650. if (! info) {
  12651. context.method = "throw";
  12652. context.arg = new TypeError("iterator result is not an object");
  12653. context.delegate = null;
  12654. return ContinueSentinel;
  12655. }
  12656. if (info.done) {
  12657. // Assign the result of the finished delegate to the temporary
  12658. // variable specified by delegate.resultName (see delegateYield).
  12659. context[delegate.resultName] = info.value;
  12660. // Resume execution at the desired location (see delegateYield).
  12661. context.next = delegate.nextLoc;
  12662. // If context.method was "throw" but the delegate handled the
  12663. // exception, let the outer generator proceed normally. If
  12664. // context.method was "next", forget context.arg since it has been
  12665. // "consumed" by the delegate iterator. If context.method was
  12666. // "return", allow the original .return call to continue in the
  12667. // outer generator.
  12668. if (context.method !== "return") {
  12669. context.method = "next";
  12670. context.arg = undefined;
  12671. }
  12672. } else {
  12673. // Re-yield the result returned by the delegate method.
  12674. return info;
  12675. }
  12676. // The delegate iterator is finished, so forget it and continue with
  12677. // the outer generator.
  12678. context.delegate = null;
  12679. return ContinueSentinel;
  12680. }
  12681. // Define Generator.prototype.{next,throw,return} in terms of the
  12682. // unified ._invoke helper method.
  12683. defineIteratorMethods(Gp);
  12684. Gp[toStringTagSymbol] = "Generator";
  12685. // A Generator should always return itself as the iterator object when the
  12686. // @@iterator function is called on it. Some browsers' implementations of the
  12687. // iterator prototype chain incorrectly implement this, causing the Generator
  12688. // object to not be returned from this call. This ensures that doesn't happen.
  12689. // See https://github.com/facebook/regenerator/issues/274 for more details.
  12690. Gp[iteratorSymbol] = function() {
  12691. return this;
  12692. };
  12693. Gp.toString = function() {
  12694. return "[object Generator]";
  12695. };
  12696. function pushTryEntry(locs) {
  12697. var entry = { tryLoc: locs[0] };
  12698. if (1 in locs) {
  12699. entry.catchLoc = locs[1];
  12700. }
  12701. if (2 in locs) {
  12702. entry.finallyLoc = locs[2];
  12703. entry.afterLoc = locs[3];
  12704. }
  12705. this.tryEntries.push(entry);
  12706. }
  12707. function resetTryEntry(entry) {
  12708. var record = entry.completion || {};
  12709. record.type = "normal";
  12710. delete record.arg;
  12711. entry.completion = record;
  12712. }
  12713. function Context(tryLocsList) {
  12714. // The root entry object (effectively a try statement without a catch
  12715. // or a finally block) gives us a place to store values thrown from
  12716. // locations where there is no enclosing try statement.
  12717. this.tryEntries = [{ tryLoc: "root" }];
  12718. tryLocsList.forEach(pushTryEntry, this);
  12719. this.reset(true);
  12720. }
  12721. exports.keys = function(object) {
  12722. var keys = [];
  12723. for (var key in object) {
  12724. keys.push(key);
  12725. }
  12726. keys.reverse();
  12727. // Rather than returning an object with a next method, we keep
  12728. // things simple and return the next function itself.
  12729. return function next() {
  12730. while (keys.length) {
  12731. var key = keys.pop();
  12732. if (key in object) {
  12733. next.value = key;
  12734. next.done = false;
  12735. return next;
  12736. }
  12737. }
  12738. // To avoid creating an additional object, we just hang the .value
  12739. // and .done properties off the next function object itself. This
  12740. // also ensures that the minifier will not anonymize the function.
  12741. next.done = true;
  12742. return next;
  12743. };
  12744. };
  12745. function values(iterable) {
  12746. if (iterable) {
  12747. var iteratorMethod = iterable[iteratorSymbol];
  12748. if (iteratorMethod) {
  12749. return iteratorMethod.call(iterable);
  12750. }
  12751. if (typeof iterable.next === "function") {
  12752. return iterable;
  12753. }
  12754. if (!isNaN(iterable.length)) {
  12755. var i = -1, next = function next() {
  12756. while (++i < iterable.length) {
  12757. if (hasOwn.call(iterable, i)) {
  12758. next.value = iterable[i];
  12759. next.done = false;
  12760. return next;
  12761. }
  12762. }
  12763. next.value = undefined;
  12764. next.done = true;
  12765. return next;
  12766. };
  12767. return next.next = next;
  12768. }
  12769. }
  12770. // Return an iterator with no values.
  12771. return { next: doneResult };
  12772. }
  12773. exports.values = values;
  12774. function doneResult() {
  12775. return { value: undefined, done: true };
  12776. }
  12777. Context.prototype = {
  12778. constructor: Context,
  12779. reset: function(skipTempReset) {
  12780. this.prev = 0;
  12781. this.next = 0;
  12782. // Resetting context._sent for legacy support of Babel's
  12783. // function.sent implementation.
  12784. this.sent = this._sent = undefined;
  12785. this.done = false;
  12786. this.delegate = null;
  12787. this.method = "next";
  12788. this.arg = undefined;
  12789. this.tryEntries.forEach(resetTryEntry);
  12790. if (!skipTempReset) {
  12791. for (var name in this) {
  12792. // Not sure about the optimal order of these conditions:
  12793. if (name.charAt(0) === "t" &&
  12794. hasOwn.call(this, name) &&
  12795. !isNaN(+name.slice(1))) {
  12796. this[name] = undefined;
  12797. }
  12798. }
  12799. }
  12800. },
  12801. stop: function() {
  12802. this.done = true;
  12803. var rootEntry = this.tryEntries[0];
  12804. var rootRecord = rootEntry.completion;
  12805. if (rootRecord.type === "throw") {
  12806. throw rootRecord.arg;
  12807. }
  12808. return this.rval;
  12809. },
  12810. dispatchException: function(exception) {
  12811. if (this.done) {
  12812. throw exception;
  12813. }
  12814. var context = this;
  12815. function handle(loc, caught) {
  12816. record.type = "throw";
  12817. record.arg = exception;
  12818. context.next = loc;
  12819. if (caught) {
  12820. // If the dispatched exception was caught by a catch block,
  12821. // then let that catch block handle the exception normally.
  12822. context.method = "next";
  12823. context.arg = undefined;
  12824. }
  12825. return !! caught;
  12826. }
  12827. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  12828. var entry = this.tryEntries[i];
  12829. var record = entry.completion;
  12830. if (entry.tryLoc === "root") {
  12831. // Exception thrown outside of any try block that could handle
  12832. // it, so set the completion value of the entire function to
  12833. // throw the exception.
  12834. return handle("end");
  12835. }
  12836. if (entry.tryLoc <= this.prev) {
  12837. var hasCatch = hasOwn.call(entry, "catchLoc");
  12838. var hasFinally = hasOwn.call(entry, "finallyLoc");
  12839. if (hasCatch && hasFinally) {
  12840. if (this.prev < entry.catchLoc) {
  12841. return handle(entry.catchLoc, true);
  12842. } else if (this.prev < entry.finallyLoc) {
  12843. return handle(entry.finallyLoc);
  12844. }
  12845. } else if (hasCatch) {
  12846. if (this.prev < entry.catchLoc) {
  12847. return handle(entry.catchLoc, true);
  12848. }
  12849. } else if (hasFinally) {
  12850. if (this.prev < entry.finallyLoc) {
  12851. return handle(entry.finallyLoc);
  12852. }
  12853. } else {
  12854. throw new Error("try statement without catch or finally");
  12855. }
  12856. }
  12857. }
  12858. },
  12859. abrupt: function(type, arg) {
  12860. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  12861. var entry = this.tryEntries[i];
  12862. if (entry.tryLoc <= this.prev &&
  12863. hasOwn.call(entry, "finallyLoc") &&
  12864. this.prev < entry.finallyLoc) {
  12865. var finallyEntry = entry;
  12866. break;
  12867. }
  12868. }
  12869. if (finallyEntry &&
  12870. (type === "break" ||
  12871. type === "continue") &&
  12872. finallyEntry.tryLoc <= arg &&
  12873. arg <= finallyEntry.finallyLoc) {
  12874. // Ignore the finally entry if control is not jumping to a
  12875. // location outside the try/catch block.
  12876. finallyEntry = null;
  12877. }
  12878. var record = finallyEntry ? finallyEntry.completion : {};
  12879. record.type = type;
  12880. record.arg = arg;
  12881. if (finallyEntry) {
  12882. this.method = "next";
  12883. this.next = finallyEntry.finallyLoc;
  12884. return ContinueSentinel;
  12885. }
  12886. return this.complete(record);
  12887. },
  12888. complete: function(record, afterLoc) {
  12889. if (record.type === "throw") {
  12890. throw record.arg;
  12891. }
  12892. if (record.type === "break" ||
  12893. record.type === "continue") {
  12894. this.next = record.arg;
  12895. } else if (record.type === "return") {
  12896. this.rval = this.arg = record.arg;
  12897. this.method = "return";
  12898. this.next = "end";
  12899. } else if (record.type === "normal" && afterLoc) {
  12900. this.next = afterLoc;
  12901. }
  12902. return ContinueSentinel;
  12903. },
  12904. finish: function(finallyLoc) {
  12905. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  12906. var entry = this.tryEntries[i];
  12907. if (entry.finallyLoc === finallyLoc) {
  12908. this.complete(entry.completion, entry.afterLoc);
  12909. resetTryEntry(entry);
  12910. return ContinueSentinel;
  12911. }
  12912. }
  12913. },
  12914. "catch": function(tryLoc) {
  12915. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  12916. var entry = this.tryEntries[i];
  12917. if (entry.tryLoc === tryLoc) {
  12918. var record = entry.completion;
  12919. if (record.type === "throw") {
  12920. var thrown = record.arg;
  12921. resetTryEntry(entry);
  12922. }
  12923. return thrown;
  12924. }
  12925. }
  12926. // The context.catch method must only be called with a location
  12927. // argument that corresponds to a known catch block.
  12928. throw new Error("illegal catch attempt");
  12929. },
  12930. delegateYield: function(iterable, resultName, nextLoc) {
  12931. this.delegate = {
  12932. iterator: values(iterable),
  12933. resultName: resultName,
  12934. nextLoc: nextLoc
  12935. };
  12936. if (this.method === "next") {
  12937. // Deliberately forget the last sent value so that we don't
  12938. // accidentally pass it on to the delegate.
  12939. this.arg = undefined;
  12940. }
  12941. return ContinueSentinel;
  12942. }
  12943. };
  12944. // Regardless of whether this script is executing as a CommonJS module
  12945. // or not, return the runtime object so that we can declare the variable
  12946. // regeneratorRuntime in the outer scope, which allows this module to be
  12947. // injected easily by `bin/regenerator --include-runtime script.js`.
  12948. return exports;
  12949. }(
  12950. // If this script is executing as a CommonJS module, use module.exports
  12951. // as the regeneratorRuntime namespace. Otherwise create a new empty
  12952. // object. Either way, the resulting object will be used to initialize
  12953. // the regeneratorRuntime variable at the top of this file.
  12954. true ? module.exports : undefined
  12955. ));
  12956. try {
  12957. regeneratorRuntime = runtime;
  12958. } catch (accidentalStrictMode) {
  12959. // This module should not be running in strict mode, so the above
  12960. // assignment should always work unless something is misconfigured. Just
  12961. // in case runtime.js accidentally runs in strict mode, we can escape
  12962. // strict mode using a global Function call. This could conceivably fail
  12963. // if a Content Security Policy forbids using Function, but in that case
  12964. // the proper solution is to fix the accidental strict mode problem. If
  12965. // you've misconfigured your bundler to force strict mode and applied a
  12966. // CSP to forbid Function, and you're not willing to fix either of those
  12967. // problems, please detail your unique predicament in a GitHub issue.
  12968. Function("r", "regeneratorRuntime = r")(runtime);
  12969. }
  12970. /***/ }),
  12971. /***/ 5:
  12972. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  12973. "use strict";
  12974. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; });
  12975. function _assertThisInitialized(self) {
  12976. if (self === void 0) {
  12977. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  12978. }
  12979. return self;
  12980. }
  12981. /***/ }),
  12982. /***/ 52:
  12983. /***/ (function(module, exports) {
  12984. (function() { module.exports = this["wp"]["htmlEntities"]; }());
  12985. /***/ }),
  12986. /***/ 53:
  12987. /***/ (function(module, exports) {
  12988. (function() { module.exports = this["wp"]["date"]; }());
  12989. /***/ }),
  12990. /***/ 58:
  12991. /***/ (function(module, exports) {
  12992. (function() { module.exports = this["wp"]["serverSideRender"]; }());
  12993. /***/ }),
  12994. /***/ 6:
  12995. /***/ (function(module, exports) {
  12996. (function() { module.exports = this["wp"]["blockEditor"]; }());
  12997. /***/ }),
  12998. /***/ 61:
  12999. /***/ (function(module, exports) {
  13000. (function() { module.exports = this["wp"]["nux"]; }());
  13001. /***/ }),
  13002. /***/ 62:
  13003. /***/ (function(module, exports, __webpack_require__) {
  13004. "use strict";
  13005. exports.__esModule = true;
  13006. var TextareaAutosize_1 = __webpack_require__(115);
  13007. exports["default"] = TextareaAutosize_1["default"];
  13008. /***/ }),
  13009. /***/ 69:
  13010. /***/ (function(module, exports) {
  13011. (function() { module.exports = this["wp"]["autop"]; }());
  13012. /***/ }),
  13013. /***/ 7:
  13014. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  13015. "use strict";
  13016. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
  13017. /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
  13018. function _objectSpread(target) {
  13019. for (var i = 1; i < arguments.length; i++) {
  13020. var source = arguments[i] != null ? arguments[i] : {};
  13021. var ownKeys = Object.keys(source);
  13022. if (typeof Object.getOwnPropertySymbols === 'function') {
  13023. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
  13024. return Object.getOwnPropertyDescriptor(source, sym).enumerable;
  13025. }));
  13026. }
  13027. ownKeys.forEach(function (key) {
  13028. Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
  13029. });
  13030. }
  13031. return target;
  13032. }
  13033. /***/ }),
  13034. /***/ 72:
  13035. /***/ (function(module, exports, __webpack_require__) {
  13036. "use strict";
  13037. function flattenIntoMap( map, effects ) {
  13038. var i;
  13039. if ( Array.isArray( effects ) ) {
  13040. for ( i = 0; i < effects.length; i++ ) {
  13041. flattenIntoMap( map, effects[ i ] );
  13042. }
  13043. } else {
  13044. for ( i in effects ) {
  13045. map[ i ] = ( map[ i ] || [] ).concat( effects[ i ] );
  13046. }
  13047. }
  13048. }
  13049. function refx( effects ) {
  13050. var map = {},
  13051. middleware;
  13052. flattenIntoMap( map, effects );
  13053. middleware = function( store ) {
  13054. return function( next ) {
  13055. return function( action ) {
  13056. var handlers = map[ action.type ],
  13057. result = next( action ),
  13058. i, handlerAction;
  13059. if ( handlers ) {
  13060. for ( i = 0; i < handlers.length; i++ ) {
  13061. handlerAction = handlers[ i ]( action, store );
  13062. if ( handlerAction ) {
  13063. store.dispatch( handlerAction );
  13064. }
  13065. }
  13066. }
  13067. return result;
  13068. };
  13069. };
  13070. };
  13071. middleware.effects = map;
  13072. return middleware;
  13073. }
  13074. module.exports = refx;
  13075. /***/ }),
  13076. /***/ 8:
  13077. /***/ (function(module, exports) {
  13078. (function() { module.exports = this["wp"]["compose"]; }());
  13079. /***/ }),
  13080. /***/ 83:
  13081. /***/ (function(module, exports, __webpack_require__) {
  13082. module.exports = __webpack_require__(325);
  13083. /***/ }),
  13084. /***/ 87:
  13085. /***/ (function(module, exports, __webpack_require__) {
  13086. "use strict";
  13087. /**
  13088. * Copyright (c) 2013-present, Facebook, Inc.
  13089. *
  13090. * This source code is licensed under the MIT license found in the
  13091. * LICENSE file in the root directory of this source tree.
  13092. */
  13093. var ReactPropTypesSecret = __webpack_require__(88);
  13094. function emptyFunction() {}
  13095. function emptyFunctionWithReset() {}
  13096. emptyFunctionWithReset.resetWarningCache = emptyFunction;
  13097. module.exports = function() {
  13098. function shim(props, propName, componentName, location, propFullName, secret) {
  13099. if (secret === ReactPropTypesSecret) {
  13100. // It is still safe when called from React.
  13101. return;
  13102. }
  13103. var err = new Error(
  13104. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  13105. 'Use PropTypes.checkPropTypes() to call them. ' +
  13106. 'Read more at http://fb.me/use-check-prop-types'
  13107. );
  13108. err.name = 'Invariant Violation';
  13109. throw err;
  13110. };
  13111. shim.isRequired = shim;
  13112. function getShim() {
  13113. return shim;
  13114. };
  13115. // Important!
  13116. // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
  13117. var ReactPropTypes = {
  13118. array: shim,
  13119. bool: shim,
  13120. func: shim,
  13121. number: shim,
  13122. object: shim,
  13123. string: shim,
  13124. symbol: shim,
  13125. any: shim,
  13126. arrayOf: getShim,
  13127. element: shim,
  13128. elementType: shim,
  13129. instanceOf: getShim,
  13130. node: shim,
  13131. objectOf: getShim,
  13132. oneOf: getShim,
  13133. oneOfType: getShim,
  13134. shape: getShim,
  13135. exact: getShim,
  13136. checkPropTypes: emptyFunctionWithReset,
  13137. resetWarningCache: emptyFunction
  13138. };
  13139. ReactPropTypes.PropTypes = ReactPropTypes;
  13140. return ReactPropTypes;
  13141. };
  13142. /***/ }),
  13143. /***/ 88:
  13144. /***/ (function(module, exports, __webpack_require__) {
  13145. "use strict";
  13146. /**
  13147. * Copyright (c) 2013-present, Facebook, Inc.
  13148. *
  13149. * This source code is licensed under the MIT license found in the
  13150. * LICENSE file in the root directory of this source tree.
  13151. */
  13152. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  13153. module.exports = ReactPropTypesSecret;
  13154. /***/ }),
  13155. /***/ 89:
  13156. /***/ (function(module, exports) {
  13157. (function() { module.exports = this["wp"]["coreData"]; }());
  13158. /***/ }),
  13159. /***/ 9:
  13160. /***/ (function(module, exports) {
  13161. (function() { module.exports = this["wp"]["blocks"]; }());
  13162. /***/ }),
  13163. /***/ 97:
  13164. /***/ (function(module, exports) {
  13165. (function() { module.exports = this["wp"]["wordcount"]; }());
  13166. /***/ }),
  13167. /***/ 99:
  13168. /***/ (function(module, exports) {
  13169. (function() { module.exports = this["wp"]["mediaUtils"]; }());
  13170. /***/ })
  13171. /******/ });