editor.js 402 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 6411:
  4. /***/ (function(module, exports) {
  5. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  6. autosize 4.0.4
  7. license: MIT
  8. http://www.jacklmoore.com/autosize
  9. */
  10. (function (global, factory) {
  11. if (true) {
  12. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  13. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  15. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16. } else { var mod; }
  17. })(this, function (module, exports) {
  18. 'use strict';
  19. var map = typeof Map === "function" ? new Map() : function () {
  20. var keys = [];
  21. var values = [];
  22. return {
  23. has: function has(key) {
  24. return keys.indexOf(key) > -1;
  25. },
  26. get: function get(key) {
  27. return values[keys.indexOf(key)];
  28. },
  29. set: function set(key, value) {
  30. if (keys.indexOf(key) === -1) {
  31. keys.push(key);
  32. values.push(value);
  33. }
  34. },
  35. delete: function _delete(key) {
  36. var index = keys.indexOf(key);
  37. if (index > -1) {
  38. keys.splice(index, 1);
  39. values.splice(index, 1);
  40. }
  41. }
  42. };
  43. }();
  44. var createEvent = function createEvent(name) {
  45. return new Event(name, { bubbles: true });
  46. };
  47. try {
  48. new Event('test');
  49. } catch (e) {
  50. // IE does not support `new Event()`
  51. createEvent = function createEvent(name) {
  52. var evt = document.createEvent('Event');
  53. evt.initEvent(name, true, false);
  54. return evt;
  55. };
  56. }
  57. function assign(ta) {
  58. if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
  59. var heightOffset = null;
  60. var clientWidth = null;
  61. var cachedHeight = null;
  62. function init() {
  63. var style = window.getComputedStyle(ta, null);
  64. if (style.resize === 'vertical') {
  65. ta.style.resize = 'none';
  66. } else if (style.resize === 'both') {
  67. ta.style.resize = 'horizontal';
  68. }
  69. if (style.boxSizing === 'content-box') {
  70. heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  71. } else {
  72. heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  73. }
  74. // Fix when a textarea is not on document body and heightOffset is Not a Number
  75. if (isNaN(heightOffset)) {
  76. heightOffset = 0;
  77. }
  78. update();
  79. }
  80. function changeOverflow(value) {
  81. {
  82. // Chrome/Safari-specific fix:
  83. // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  84. // made available by removing the scrollbar. The following forces the necessary text reflow.
  85. var width = ta.style.width;
  86. ta.style.width = '0px';
  87. // Force reflow:
  88. /* jshint ignore:start */
  89. ta.offsetWidth;
  90. /* jshint ignore:end */
  91. ta.style.width = width;
  92. }
  93. ta.style.overflowY = value;
  94. }
  95. function getParentOverflows(el) {
  96. var arr = [];
  97. while (el && el.parentNode && el.parentNode instanceof Element) {
  98. if (el.parentNode.scrollTop) {
  99. arr.push({
  100. node: el.parentNode,
  101. scrollTop: el.parentNode.scrollTop
  102. });
  103. }
  104. el = el.parentNode;
  105. }
  106. return arr;
  107. }
  108. function resize() {
  109. if (ta.scrollHeight === 0) {
  110. // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
  111. return;
  112. }
  113. var overflows = getParentOverflows(ta);
  114. var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
  115. ta.style.height = '';
  116. ta.style.height = ta.scrollHeight + heightOffset + 'px';
  117. // used to check if an update is actually necessary on window.resize
  118. clientWidth = ta.clientWidth;
  119. // prevents scroll-position jumping
  120. overflows.forEach(function (el) {
  121. el.node.scrollTop = el.scrollTop;
  122. });
  123. if (docTop) {
  124. document.documentElement.scrollTop = docTop;
  125. }
  126. }
  127. function update() {
  128. resize();
  129. var styleHeight = Math.round(parseFloat(ta.style.height));
  130. var computed = window.getComputedStyle(ta, null);
  131. // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
  132. var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
  133. // The actual height not matching the style height (set via the resize method) indicates that
  134. // the max-height has been exceeded, in which case the overflow should be allowed.
  135. if (actualHeight < styleHeight) {
  136. if (computed.overflowY === 'hidden') {
  137. changeOverflow('scroll');
  138. resize();
  139. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  140. }
  141. } else {
  142. // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
  143. if (computed.overflowY !== 'hidden') {
  144. changeOverflow('hidden');
  145. resize();
  146. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  147. }
  148. }
  149. if (cachedHeight !== actualHeight) {
  150. cachedHeight = actualHeight;
  151. var evt = createEvent('autosize:resized');
  152. try {
  153. ta.dispatchEvent(evt);
  154. } catch (err) {
  155. // Firefox will throw an error on dispatchEvent for a detached element
  156. // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
  157. }
  158. }
  159. }
  160. var pageResize = function pageResize() {
  161. if (ta.clientWidth !== clientWidth) {
  162. update();
  163. }
  164. };
  165. var destroy = function (style) {
  166. window.removeEventListener('resize', pageResize, false);
  167. ta.removeEventListener('input', update, false);
  168. ta.removeEventListener('keyup', update, false);
  169. ta.removeEventListener('autosize:destroy', destroy, false);
  170. ta.removeEventListener('autosize:update', update, false);
  171. Object.keys(style).forEach(function (key) {
  172. ta.style[key] = style[key];
  173. });
  174. map.delete(ta);
  175. }.bind(ta, {
  176. height: ta.style.height,
  177. resize: ta.style.resize,
  178. overflowY: ta.style.overflowY,
  179. overflowX: ta.style.overflowX,
  180. wordWrap: ta.style.wordWrap
  181. });
  182. ta.addEventListener('autosize:destroy', destroy, false);
  183. // IE9 does not fire onpropertychange or oninput for deletions,
  184. // so binding to onkeyup to catch most of those events.
  185. // There is no way that I know of to detect something like 'cut' in IE9.
  186. if ('onpropertychange' in ta && 'oninput' in ta) {
  187. ta.addEventListener('keyup', update, false);
  188. }
  189. window.addEventListener('resize', pageResize, false);
  190. ta.addEventListener('input', update, false);
  191. ta.addEventListener('autosize:update', update, false);
  192. ta.style.overflowX = 'hidden';
  193. ta.style.wordWrap = 'break-word';
  194. map.set(ta, {
  195. destroy: destroy,
  196. update: update
  197. });
  198. init();
  199. }
  200. function destroy(ta) {
  201. var methods = map.get(ta);
  202. if (methods) {
  203. methods.destroy();
  204. }
  205. }
  206. function update(ta) {
  207. var methods = map.get(ta);
  208. if (methods) {
  209. methods.update();
  210. }
  211. }
  212. var autosize = null;
  213. // Do nothing in Node.js environment and IE8 (or lower)
  214. if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
  215. autosize = function autosize(el) {
  216. return el;
  217. };
  218. autosize.destroy = function (el) {
  219. return el;
  220. };
  221. autosize.update = function (el) {
  222. return el;
  223. };
  224. } else {
  225. autosize = function autosize(el, options) {
  226. if (el) {
  227. Array.prototype.forEach.call(el.length ? el : [el], function (x) {
  228. return assign(x, options);
  229. });
  230. }
  231. return el;
  232. };
  233. autosize.destroy = function (el) {
  234. if (el) {
  235. Array.prototype.forEach.call(el.length ? el : [el], destroy);
  236. }
  237. return el;
  238. };
  239. autosize.update = function (el) {
  240. if (el) {
  241. Array.prototype.forEach.call(el.length ? el : [el], update);
  242. }
  243. return el;
  244. };
  245. }
  246. exports.default = autosize;
  247. module.exports = exports['default'];
  248. });
  249. /***/ }),
  250. /***/ 4403:
  251. /***/ (function(module, exports) {
  252. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  253. Copyright (c) 2018 Jed Watson.
  254. Licensed under the MIT License (MIT), see
  255. http://jedwatson.github.io/classnames
  256. */
  257. /* global define */
  258. (function () {
  259. 'use strict';
  260. var hasOwn = {}.hasOwnProperty;
  261. var nativeCodeString = '[native code]';
  262. function classNames() {
  263. var classes = [];
  264. for (var i = 0; i < arguments.length; i++) {
  265. var arg = arguments[i];
  266. if (!arg) continue;
  267. var argType = typeof arg;
  268. if (argType === 'string' || argType === 'number') {
  269. classes.push(arg);
  270. } else if (Array.isArray(arg)) {
  271. if (arg.length) {
  272. var inner = classNames.apply(null, arg);
  273. if (inner) {
  274. classes.push(inner);
  275. }
  276. }
  277. } else if (argType === 'object') {
  278. if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
  279. classes.push(arg.toString());
  280. continue;
  281. }
  282. for (var key in arg) {
  283. if (hasOwn.call(arg, key) && arg[key]) {
  284. classes.push(key);
  285. }
  286. }
  287. }
  288. }
  289. return classes.join(' ');
  290. }
  291. if ( true && module.exports) {
  292. classNames.default = classNames;
  293. module.exports = classNames;
  294. } else if (true) {
  295. // register as 'classnames', consistent with npm package name
  296. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  297. return classNames;
  298. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  299. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  300. } else {}
  301. }());
  302. /***/ }),
  303. /***/ 4827:
  304. /***/ (function(module) {
  305. // This code has been refactored for 140 bytes
  306. // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
  307. var computedStyle = function (el, prop, getComputedStyle) {
  308. getComputedStyle = window.getComputedStyle;
  309. // In one fell swoop
  310. return (
  311. // If we have getComputedStyle
  312. getComputedStyle ?
  313. // Query it
  314. // TODO: From CSS-Query notes, we might need (node, null) for FF
  315. getComputedStyle(el) :
  316. // Otherwise, we are in IE and use currentStyle
  317. el.currentStyle
  318. )[
  319. // Switch to camelCase for CSSOM
  320. // DEV: Grabbed from jQuery
  321. // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
  322. // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
  323. prop.replace(/-(\w)/gi, function (word, letter) {
  324. return letter.toUpperCase();
  325. })
  326. ];
  327. };
  328. module.exports = computedStyle;
  329. /***/ }),
  330. /***/ 9894:
  331. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  332. // Load in dependencies
  333. var computedStyle = __webpack_require__(4827);
  334. /**
  335. * Calculate the `line-height` of a given node
  336. * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
  337. * @returns {Number} `line-height` of the element in pixels
  338. */
  339. function lineHeight(node) {
  340. // Grab the line-height via style
  341. var lnHeightStr = computedStyle(node, 'line-height');
  342. var lnHeight = parseFloat(lnHeightStr, 10);
  343. // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
  344. if (lnHeightStr === lnHeight + '') {
  345. // Save the old lineHeight style and update the em unit to the element
  346. var _lnHeightStyle = node.style.lineHeight;
  347. node.style.lineHeight = lnHeightStr + 'em';
  348. // Calculate the em based height
  349. lnHeightStr = computedStyle(node, 'line-height');
  350. lnHeight = parseFloat(lnHeightStr, 10);
  351. // Revert the lineHeight style
  352. if (_lnHeightStyle) {
  353. node.style.lineHeight = _lnHeightStyle;
  354. } else {
  355. delete node.style.lineHeight;
  356. }
  357. }
  358. // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
  359. // DEV: `em` units are converted to `pt` in IE6
  360. // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
  361. if (lnHeightStr.indexOf('pt') !== -1) {
  362. lnHeight *= 4;
  363. lnHeight /= 3;
  364. // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
  365. } else if (lnHeightStr.indexOf('mm') !== -1) {
  366. lnHeight *= 96;
  367. lnHeight /= 25.4;
  368. // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
  369. } else if (lnHeightStr.indexOf('cm') !== -1) {
  370. lnHeight *= 96;
  371. lnHeight /= 2.54;
  372. // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
  373. } else if (lnHeightStr.indexOf('in') !== -1) {
  374. lnHeight *= 96;
  375. // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
  376. } else if (lnHeightStr.indexOf('pc') !== -1) {
  377. lnHeight *= 16;
  378. }
  379. // Continue our computation
  380. lnHeight = Math.round(lnHeight);
  381. // If the line-height is "normal", calculate by font-size
  382. if (lnHeightStr === 'normal') {
  383. // Create a temporary node
  384. var nodeName = node.nodeName;
  385. var _node = document.createElement(nodeName);
  386. _node.innerHTML = '&nbsp;';
  387. // If we have a text area, reset it to only 1 row
  388. // https://github.com/twolfson/line-height/issues/4
  389. if (nodeName.toUpperCase() === 'TEXTAREA') {
  390. _node.setAttribute('rows', '1');
  391. }
  392. // Set the font-size of the element
  393. var fontSizeStr = computedStyle(node, 'font-size');
  394. _node.style.fontSize = fontSizeStr;
  395. // Remove default padding/border which can affect offset height
  396. // https://github.com/twolfson/line-height/issues/4
  397. // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
  398. _node.style.padding = '0px';
  399. _node.style.border = '0px';
  400. // Append it to the body
  401. var body = document.body;
  402. body.appendChild(_node);
  403. // Assume the line height of the element is the height
  404. var height = _node.offsetHeight;
  405. lnHeight = height;
  406. // Remove our child from the DOM
  407. body.removeChild(_node);
  408. }
  409. // Return the calculated height
  410. return lnHeight;
  411. }
  412. // Export lineHeight
  413. module.exports = lineHeight;
  414. /***/ }),
  415. /***/ 5372:
  416. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  417. "use strict";
  418. /**
  419. * Copyright (c) 2013-present, Facebook, Inc.
  420. *
  421. * This source code is licensed under the MIT license found in the
  422. * LICENSE file in the root directory of this source tree.
  423. */
  424. var ReactPropTypesSecret = __webpack_require__(9567);
  425. function emptyFunction() {}
  426. function emptyFunctionWithReset() {}
  427. emptyFunctionWithReset.resetWarningCache = emptyFunction;
  428. module.exports = function() {
  429. function shim(props, propName, componentName, location, propFullName, secret) {
  430. if (secret === ReactPropTypesSecret) {
  431. // It is still safe when called from React.
  432. return;
  433. }
  434. var err = new Error(
  435. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  436. 'Use PropTypes.checkPropTypes() to call them. ' +
  437. 'Read more at http://fb.me/use-check-prop-types'
  438. );
  439. err.name = 'Invariant Violation';
  440. throw err;
  441. };
  442. shim.isRequired = shim;
  443. function getShim() {
  444. return shim;
  445. };
  446. // Important!
  447. // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
  448. var ReactPropTypes = {
  449. array: shim,
  450. bigint: shim,
  451. bool: shim,
  452. func: shim,
  453. number: shim,
  454. object: shim,
  455. string: shim,
  456. symbol: shim,
  457. any: shim,
  458. arrayOf: getShim,
  459. element: shim,
  460. elementType: shim,
  461. instanceOf: getShim,
  462. node: shim,
  463. objectOf: getShim,
  464. oneOf: getShim,
  465. oneOfType: getShim,
  466. shape: getShim,
  467. exact: getShim,
  468. checkPropTypes: emptyFunctionWithReset,
  469. resetWarningCache: emptyFunction
  470. };
  471. ReactPropTypes.PropTypes = ReactPropTypes;
  472. return ReactPropTypes;
  473. };
  474. /***/ }),
  475. /***/ 2652:
  476. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  477. /**
  478. * Copyright (c) 2013-present, Facebook, Inc.
  479. *
  480. * This source code is licensed under the MIT license found in the
  481. * LICENSE file in the root directory of this source tree.
  482. */
  483. if (false) { var throwOnDirectAccess, ReactIs; } else {
  484. // By explicitly using `prop-types` you are opting into new production behavior.
  485. // http://fb.me/prop-types-in-prod
  486. module.exports = __webpack_require__(5372)();
  487. }
  488. /***/ }),
  489. /***/ 9567:
  490. /***/ (function(module) {
  491. "use strict";
  492. /**
  493. * Copyright (c) 2013-present, Facebook, Inc.
  494. *
  495. * This source code is licensed under the MIT license found in the
  496. * LICENSE file in the root directory of this source tree.
  497. */
  498. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  499. module.exports = ReactPropTypesSecret;
  500. /***/ }),
  501. /***/ 5438:
  502. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  503. "use strict";
  504. var __extends = (this && this.__extends) || (function () {
  505. var extendStatics = Object.setPrototypeOf ||
  506. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  507. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  508. return function (d, b) {
  509. extendStatics(d, b);
  510. function __() { this.constructor = d; }
  511. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  512. };
  513. })();
  514. var __assign = (this && this.__assign) || Object.assign || function(t) {
  515. for (var s, i = 1, n = arguments.length; i < n; i++) {
  516. s = arguments[i];
  517. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  518. t[p] = s[p];
  519. }
  520. return t;
  521. };
  522. var __rest = (this && this.__rest) || function (s, e) {
  523. var t = {};
  524. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  525. t[p] = s[p];
  526. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  527. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
  528. t[p[i]] = s[p[i]];
  529. return t;
  530. };
  531. exports.__esModule = true;
  532. var React = __webpack_require__(9196);
  533. var PropTypes = __webpack_require__(2652);
  534. var autosize = __webpack_require__(6411);
  535. var _getLineHeight = __webpack_require__(9894);
  536. var getLineHeight = _getLineHeight;
  537. var RESIZED = "autosize:resized";
  538. /**
  539. * A light replacement for built-in textarea component
  540. * which automaticaly adjusts its height to match the content
  541. */
  542. var TextareaAutosizeClass = /** @class */ (function (_super) {
  543. __extends(TextareaAutosizeClass, _super);
  544. function TextareaAutosizeClass() {
  545. var _this = _super !== null && _super.apply(this, arguments) || this;
  546. _this.state = {
  547. lineHeight: null
  548. };
  549. _this.textarea = null;
  550. _this.onResize = function (e) {
  551. if (_this.props.onResize) {
  552. _this.props.onResize(e);
  553. }
  554. };
  555. _this.updateLineHeight = function () {
  556. if (_this.textarea) {
  557. _this.setState({
  558. lineHeight: getLineHeight(_this.textarea)
  559. });
  560. }
  561. };
  562. _this.onChange = function (e) {
  563. var onChange = _this.props.onChange;
  564. _this.currentValue = e.currentTarget.value;
  565. onChange && onChange(e);
  566. };
  567. return _this;
  568. }
  569. TextareaAutosizeClass.prototype.componentDidMount = function () {
  570. var _this = this;
  571. var _a = this.props, maxRows = _a.maxRows, async = _a.async;
  572. if (typeof maxRows === "number") {
  573. this.updateLineHeight();
  574. }
  575. if (typeof maxRows === "number" || async) {
  576. /*
  577. the defer is needed to:
  578. - force "autosize" to activate the scrollbar when this.props.maxRows is passed
  579. - support StyledComponents (see #71)
  580. */
  581. setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
  582. }
  583. else {
  584. this.textarea && autosize(this.textarea);
  585. }
  586. if (this.textarea) {
  587. this.textarea.addEventListener(RESIZED, this.onResize);
  588. }
  589. };
  590. TextareaAutosizeClass.prototype.componentWillUnmount = function () {
  591. if (this.textarea) {
  592. this.textarea.removeEventListener(RESIZED, this.onResize);
  593. autosize.destroy(this.textarea);
  594. }
  595. };
  596. TextareaAutosizeClass.prototype.render = function () {
  597. var _this = this;
  598. var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight;
  599. var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
  600. return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
  601. _this.textarea = element;
  602. if (typeof _this.props.innerRef === 'function') {
  603. _this.props.innerRef(element);
  604. }
  605. else if (_this.props.innerRef) {
  606. _this.props.innerRef.current = element;
  607. }
  608. } }), children));
  609. };
  610. TextareaAutosizeClass.prototype.componentDidUpdate = function () {
  611. this.textarea && autosize.update(this.textarea);
  612. };
  613. TextareaAutosizeClass.defaultProps = {
  614. rows: 1,
  615. async: false
  616. };
  617. TextareaAutosizeClass.propTypes = {
  618. rows: PropTypes.number,
  619. maxRows: PropTypes.number,
  620. onResize: PropTypes.func,
  621. innerRef: PropTypes.any,
  622. async: PropTypes.bool
  623. };
  624. return TextareaAutosizeClass;
  625. }(React.Component));
  626. exports.TextareaAutosize = React.forwardRef(function (props, ref) {
  627. return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
  628. });
  629. /***/ }),
  630. /***/ 773:
  631. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  632. "use strict";
  633. var __webpack_unused_export__;
  634. __webpack_unused_export__ = true;
  635. var TextareaAutosize_1 = __webpack_require__(5438);
  636. exports.Z = TextareaAutosize_1.TextareaAutosize;
  637. /***/ }),
  638. /***/ 4793:
  639. /***/ (function(module) {
  640. var characterMap = {
  641. "À": "A",
  642. "Á": "A",
  643. "Â": "A",
  644. "Ã": "A",
  645. "Ä": "A",
  646. "Å": "A",
  647. "Ấ": "A",
  648. "Ắ": "A",
  649. "Ẳ": "A",
  650. "Ẵ": "A",
  651. "Ặ": "A",
  652. "Æ": "AE",
  653. "Ầ": "A",
  654. "Ằ": "A",
  655. "Ȃ": "A",
  656. "Ç": "C",
  657. "Ḉ": "C",
  658. "È": "E",
  659. "É": "E",
  660. "Ê": "E",
  661. "Ë": "E",
  662. "Ế": "E",
  663. "Ḗ": "E",
  664. "Ề": "E",
  665. "Ḕ": "E",
  666. "Ḝ": "E",
  667. "Ȇ": "E",
  668. "Ì": "I",
  669. "Í": "I",
  670. "Î": "I",
  671. "Ï": "I",
  672. "Ḯ": "I",
  673. "Ȋ": "I",
  674. "Ð": "D",
  675. "Ñ": "N",
  676. "Ò": "O",
  677. "Ó": "O",
  678. "Ô": "O",
  679. "Õ": "O",
  680. "Ö": "O",
  681. "Ø": "O",
  682. "Ố": "O",
  683. "Ṍ": "O",
  684. "Ṓ": "O",
  685. "Ȏ": "O",
  686. "Ù": "U",
  687. "Ú": "U",
  688. "Û": "U",
  689. "Ü": "U",
  690. "Ý": "Y",
  691. "à": "a",
  692. "á": "a",
  693. "â": "a",
  694. "ã": "a",
  695. "ä": "a",
  696. "å": "a",
  697. "ấ": "a",
  698. "ắ": "a",
  699. "ẳ": "a",
  700. "ẵ": "a",
  701. "ặ": "a",
  702. "æ": "ae",
  703. "ầ": "a",
  704. "ằ": "a",
  705. "ȃ": "a",
  706. "ç": "c",
  707. "ḉ": "c",
  708. "è": "e",
  709. "é": "e",
  710. "ê": "e",
  711. "ë": "e",
  712. "ế": "e",
  713. "ḗ": "e",
  714. "ề": "e",
  715. "ḕ": "e",
  716. "ḝ": "e",
  717. "ȇ": "e",
  718. "ì": "i",
  719. "í": "i",
  720. "î": "i",
  721. "ï": "i",
  722. "ḯ": "i",
  723. "ȋ": "i",
  724. "ð": "d",
  725. "ñ": "n",
  726. "ò": "o",
  727. "ó": "o",
  728. "ô": "o",
  729. "õ": "o",
  730. "ö": "o",
  731. "ø": "o",
  732. "ố": "o",
  733. "ṍ": "o",
  734. "ṓ": "o",
  735. "ȏ": "o",
  736. "ù": "u",
  737. "ú": "u",
  738. "û": "u",
  739. "ü": "u",
  740. "ý": "y",
  741. "ÿ": "y",
  742. "Ā": "A",
  743. "ā": "a",
  744. "Ă": "A",
  745. "ă": "a",
  746. "Ą": "A",
  747. "ą": "a",
  748. "Ć": "C",
  749. "ć": "c",
  750. "Ĉ": "C",
  751. "ĉ": "c",
  752. "Ċ": "C",
  753. "ċ": "c",
  754. "Č": "C",
  755. "č": "c",
  756. "C̆": "C",
  757. "c̆": "c",
  758. "Ď": "D",
  759. "ď": "d",
  760. "Đ": "D",
  761. "đ": "d",
  762. "Ē": "E",
  763. "ē": "e",
  764. "Ĕ": "E",
  765. "ĕ": "e",
  766. "Ė": "E",
  767. "ė": "e",
  768. "Ę": "E",
  769. "ę": "e",
  770. "Ě": "E",
  771. "ě": "e",
  772. "Ĝ": "G",
  773. "Ǵ": "G",
  774. "ĝ": "g",
  775. "ǵ": "g",
  776. "Ğ": "G",
  777. "ğ": "g",
  778. "Ġ": "G",
  779. "ġ": "g",
  780. "Ģ": "G",
  781. "ģ": "g",
  782. "Ĥ": "H",
  783. "ĥ": "h",
  784. "Ħ": "H",
  785. "ħ": "h",
  786. "Ḫ": "H",
  787. "ḫ": "h",
  788. "Ĩ": "I",
  789. "ĩ": "i",
  790. "Ī": "I",
  791. "ī": "i",
  792. "Ĭ": "I",
  793. "ĭ": "i",
  794. "Į": "I",
  795. "į": "i",
  796. "İ": "I",
  797. "ı": "i",
  798. "IJ": "IJ",
  799. "ij": "ij",
  800. "Ĵ": "J",
  801. "ĵ": "j",
  802. "Ķ": "K",
  803. "ķ": "k",
  804. "Ḱ": "K",
  805. "ḱ": "k",
  806. "K̆": "K",
  807. "k̆": "k",
  808. "Ĺ": "L",
  809. "ĺ": "l",
  810. "Ļ": "L",
  811. "ļ": "l",
  812. "Ľ": "L",
  813. "ľ": "l",
  814. "Ŀ": "L",
  815. "ŀ": "l",
  816. "Ł": "l",
  817. "ł": "l",
  818. "Ḿ": "M",
  819. "ḿ": "m",
  820. "M̆": "M",
  821. "m̆": "m",
  822. "Ń": "N",
  823. "ń": "n",
  824. "Ņ": "N",
  825. "ņ": "n",
  826. "Ň": "N",
  827. "ň": "n",
  828. "ʼn": "n",
  829. "N̆": "N",
  830. "n̆": "n",
  831. "Ō": "O",
  832. "ō": "o",
  833. "Ŏ": "O",
  834. "ŏ": "o",
  835. "Ő": "O",
  836. "ő": "o",
  837. "Œ": "OE",
  838. "œ": "oe",
  839. "P̆": "P",
  840. "p̆": "p",
  841. "Ŕ": "R",
  842. "ŕ": "r",
  843. "Ŗ": "R",
  844. "ŗ": "r",
  845. "Ř": "R",
  846. "ř": "r",
  847. "R̆": "R",
  848. "r̆": "r",
  849. "Ȓ": "R",
  850. "ȓ": "r",
  851. "Ś": "S",
  852. "ś": "s",
  853. "Ŝ": "S",
  854. "ŝ": "s",
  855. "Ş": "S",
  856. "Ș": "S",
  857. "ș": "s",
  858. "ş": "s",
  859. "Š": "S",
  860. "š": "s",
  861. "Ţ": "T",
  862. "ţ": "t",
  863. "ț": "t",
  864. "Ț": "T",
  865. "Ť": "T",
  866. "ť": "t",
  867. "Ŧ": "T",
  868. "ŧ": "t",
  869. "T̆": "T",
  870. "t̆": "t",
  871. "Ũ": "U",
  872. "ũ": "u",
  873. "Ū": "U",
  874. "ū": "u",
  875. "Ŭ": "U",
  876. "ŭ": "u",
  877. "Ů": "U",
  878. "ů": "u",
  879. "Ű": "U",
  880. "ű": "u",
  881. "Ų": "U",
  882. "ų": "u",
  883. "Ȗ": "U",
  884. "ȗ": "u",
  885. "V̆": "V",
  886. "v̆": "v",
  887. "Ŵ": "W",
  888. "ŵ": "w",
  889. "Ẃ": "W",
  890. "ẃ": "w",
  891. "X̆": "X",
  892. "x̆": "x",
  893. "Ŷ": "Y",
  894. "ŷ": "y",
  895. "Ÿ": "Y",
  896. "Y̆": "Y",
  897. "y̆": "y",
  898. "Ź": "Z",
  899. "ź": "z",
  900. "Ż": "Z",
  901. "ż": "z",
  902. "Ž": "Z",
  903. "ž": "z",
  904. "ſ": "s",
  905. "ƒ": "f",
  906. "Ơ": "O",
  907. "ơ": "o",
  908. "Ư": "U",
  909. "ư": "u",
  910. "Ǎ": "A",
  911. "ǎ": "a",
  912. "Ǐ": "I",
  913. "ǐ": "i",
  914. "Ǒ": "O",
  915. "ǒ": "o",
  916. "Ǔ": "U",
  917. "ǔ": "u",
  918. "Ǖ": "U",
  919. "ǖ": "u",
  920. "Ǘ": "U",
  921. "ǘ": "u",
  922. "Ǚ": "U",
  923. "ǚ": "u",
  924. "Ǜ": "U",
  925. "ǜ": "u",
  926. "Ứ": "U",
  927. "ứ": "u",
  928. "Ṹ": "U",
  929. "ṹ": "u",
  930. "Ǻ": "A",
  931. "ǻ": "a",
  932. "Ǽ": "AE",
  933. "ǽ": "ae",
  934. "Ǿ": "O",
  935. "ǿ": "o",
  936. "Þ": "TH",
  937. "þ": "th",
  938. "Ṕ": "P",
  939. "ṕ": "p",
  940. "Ṥ": "S",
  941. "ṥ": "s",
  942. "X́": "X",
  943. "x́": "x",
  944. "Ѓ": "Г",
  945. "ѓ": "г",
  946. "Ќ": "К",
  947. "ќ": "к",
  948. "A̋": "A",
  949. "a̋": "a",
  950. "E̋": "E",
  951. "e̋": "e",
  952. "I̋": "I",
  953. "i̋": "i",
  954. "Ǹ": "N",
  955. "ǹ": "n",
  956. "Ồ": "O",
  957. "ồ": "o",
  958. "Ṑ": "O",
  959. "ṑ": "o",
  960. "Ừ": "U",
  961. "ừ": "u",
  962. "Ẁ": "W",
  963. "ẁ": "w",
  964. "Ỳ": "Y",
  965. "ỳ": "y",
  966. "Ȁ": "A",
  967. "ȁ": "a",
  968. "Ȅ": "E",
  969. "ȅ": "e",
  970. "Ȉ": "I",
  971. "ȉ": "i",
  972. "Ȍ": "O",
  973. "ȍ": "o",
  974. "Ȑ": "R",
  975. "ȑ": "r",
  976. "Ȕ": "U",
  977. "ȕ": "u",
  978. "B̌": "B",
  979. "b̌": "b",
  980. "Č̣": "C",
  981. "č̣": "c",
  982. "Ê̌": "E",
  983. "ê̌": "e",
  984. "F̌": "F",
  985. "f̌": "f",
  986. "Ǧ": "G",
  987. "ǧ": "g",
  988. "Ȟ": "H",
  989. "ȟ": "h",
  990. "J̌": "J",
  991. "ǰ": "j",
  992. "Ǩ": "K",
  993. "ǩ": "k",
  994. "M̌": "M",
  995. "m̌": "m",
  996. "P̌": "P",
  997. "p̌": "p",
  998. "Q̌": "Q",
  999. "q̌": "q",
  1000. "Ř̩": "R",
  1001. "ř̩": "r",
  1002. "Ṧ": "S",
  1003. "ṧ": "s",
  1004. "V̌": "V",
  1005. "v̌": "v",
  1006. "W̌": "W",
  1007. "w̌": "w",
  1008. "X̌": "X",
  1009. "x̌": "x",
  1010. "Y̌": "Y",
  1011. "y̌": "y",
  1012. "A̧": "A",
  1013. "a̧": "a",
  1014. "B̧": "B",
  1015. "b̧": "b",
  1016. "Ḑ": "D",
  1017. "ḑ": "d",
  1018. "Ȩ": "E",
  1019. "ȩ": "e",
  1020. "Ɛ̧": "E",
  1021. "ɛ̧": "e",
  1022. "Ḩ": "H",
  1023. "ḩ": "h",
  1024. "I̧": "I",
  1025. "i̧": "i",
  1026. "Ɨ̧": "I",
  1027. "ɨ̧": "i",
  1028. "M̧": "M",
  1029. "m̧": "m",
  1030. "O̧": "O",
  1031. "o̧": "o",
  1032. "Q̧": "Q",
  1033. "q̧": "q",
  1034. "U̧": "U",
  1035. "u̧": "u",
  1036. "X̧": "X",
  1037. "x̧": "x",
  1038. "Z̧": "Z",
  1039. "z̧": "z",
  1040. };
  1041. var chars = Object.keys(characterMap).join('|');
  1042. var allAccents = new RegExp(chars, 'g');
  1043. var firstAccent = new RegExp(chars, '');
  1044. function matcher(match) {
  1045. return characterMap[match];
  1046. }
  1047. var removeAccents = function(string) {
  1048. return string.replace(allAccents, matcher);
  1049. };
  1050. var hasAccents = function(string) {
  1051. return !!string.match(firstAccent);
  1052. };
  1053. module.exports = removeAccents;
  1054. module.exports.has = hasAccents;
  1055. module.exports.remove = removeAccents;
  1056. /***/ }),
  1057. /***/ 9196:
  1058. /***/ (function(module) {
  1059. "use strict";
  1060. module.exports = window["React"];
  1061. /***/ })
  1062. /******/ });
  1063. /************************************************************************/
  1064. /******/ // The module cache
  1065. /******/ var __webpack_module_cache__ = {};
  1066. /******/
  1067. /******/ // The require function
  1068. /******/ function __webpack_require__(moduleId) {
  1069. /******/ // Check if module is in cache
  1070. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  1071. /******/ if (cachedModule !== undefined) {
  1072. /******/ return cachedModule.exports;
  1073. /******/ }
  1074. /******/ // Create a new module (and put it into the cache)
  1075. /******/ var module = __webpack_module_cache__[moduleId] = {
  1076. /******/ // no module.id needed
  1077. /******/ // no module.loaded needed
  1078. /******/ exports: {}
  1079. /******/ };
  1080. /******/
  1081. /******/ // Execute the module function
  1082. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1083. /******/
  1084. /******/ // Return the exports of the module
  1085. /******/ return module.exports;
  1086. /******/ }
  1087. /******/
  1088. /************************************************************************/
  1089. /******/ /* webpack/runtime/compat get default export */
  1090. /******/ !function() {
  1091. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1092. /******/ __webpack_require__.n = function(module) {
  1093. /******/ var getter = module && module.__esModule ?
  1094. /******/ function() { return module['default']; } :
  1095. /******/ function() { return module; };
  1096. /******/ __webpack_require__.d(getter, { a: getter });
  1097. /******/ return getter;
  1098. /******/ };
  1099. /******/ }();
  1100. /******/
  1101. /******/ /* webpack/runtime/define property getters */
  1102. /******/ !function() {
  1103. /******/ // define getter functions for harmony exports
  1104. /******/ __webpack_require__.d = function(exports, definition) {
  1105. /******/ for(var key in definition) {
  1106. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  1107. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  1108. /******/ }
  1109. /******/ }
  1110. /******/ };
  1111. /******/ }();
  1112. /******/
  1113. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  1114. /******/ !function() {
  1115. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  1116. /******/ }();
  1117. /******/
  1118. /******/ /* webpack/runtime/make namespace object */
  1119. /******/ !function() {
  1120. /******/ // define __esModule on exports
  1121. /******/ __webpack_require__.r = function(exports) {
  1122. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  1123. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  1124. /******/ }
  1125. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  1126. /******/ };
  1127. /******/ }();
  1128. /******/
  1129. /************************************************************************/
  1130. var __webpack_exports__ = {};
  1131. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  1132. !function() {
  1133. "use strict";
  1134. // ESM COMPAT FLAG
  1135. __webpack_require__.r(__webpack_exports__);
  1136. // EXPORTS
  1137. __webpack_require__.d(__webpack_exports__, {
  1138. "AlignmentToolbar": function() { return /* reexport */ AlignmentToolbar; },
  1139. "Autocomplete": function() { return /* reexport */ Autocomplete; },
  1140. "AutosaveMonitor": function() { return /* reexport */ autosave_monitor; },
  1141. "BlockAlignmentToolbar": function() { return /* reexport */ BlockAlignmentToolbar; },
  1142. "BlockControls": function() { return /* reexport */ BlockControls; },
  1143. "BlockEdit": function() { return /* reexport */ BlockEdit; },
  1144. "BlockEditorKeyboardShortcuts": function() { return /* reexport */ BlockEditorKeyboardShortcuts; },
  1145. "BlockFormatControls": function() { return /* reexport */ BlockFormatControls; },
  1146. "BlockIcon": function() { return /* reexport */ BlockIcon; },
  1147. "BlockInspector": function() { return /* reexport */ BlockInspector; },
  1148. "BlockList": function() { return /* reexport */ BlockList; },
  1149. "BlockMover": function() { return /* reexport */ BlockMover; },
  1150. "BlockNavigationDropdown": function() { return /* reexport */ BlockNavigationDropdown; },
  1151. "BlockSelectionClearer": function() { return /* reexport */ BlockSelectionClearer; },
  1152. "BlockSettingsMenu": function() { return /* reexport */ BlockSettingsMenu; },
  1153. "BlockTitle": function() { return /* reexport */ BlockTitle; },
  1154. "BlockToolbar": function() { return /* reexport */ BlockToolbar; },
  1155. "ColorPalette": function() { return /* reexport */ ColorPalette; },
  1156. "ContrastChecker": function() { return /* reexport */ ContrastChecker; },
  1157. "CopyHandler": function() { return /* reexport */ CopyHandler; },
  1158. "DefaultBlockAppender": function() { return /* reexport */ DefaultBlockAppender; },
  1159. "DocumentOutline": function() { return /* reexport */ document_outline; },
  1160. "DocumentOutlineCheck": function() { return /* reexport */ check; },
  1161. "EditorHistoryRedo": function() { return /* reexport */ editor_history_redo; },
  1162. "EditorHistoryUndo": function() { return /* reexport */ editor_history_undo; },
  1163. "EditorKeyboardShortcutsRegister": function() { return /* reexport */ register_shortcuts; },
  1164. "EditorNotices": function() { return /* reexport */ editor_notices; },
  1165. "EditorProvider": function() { return /* reexport */ provider; },
  1166. "EditorSnackbars": function() { return /* reexport */ EditorSnackbars; },
  1167. "EntitiesSavedStates": function() { return /* reexport */ EntitiesSavedStates; },
  1168. "ErrorBoundary": function() { return /* reexport */ error_boundary; },
  1169. "FontSizePicker": function() { return /* reexport */ FontSizePicker; },
  1170. "InnerBlocks": function() { return /* reexport */ InnerBlocks; },
  1171. "Inserter": function() { return /* reexport */ Inserter; },
  1172. "InspectorAdvancedControls": function() { return /* reexport */ InspectorAdvancedControls; },
  1173. "InspectorControls": function() { return /* reexport */ InspectorControls; },
  1174. "LocalAutosaveMonitor": function() { return /* reexport */ local_autosave_monitor; },
  1175. "MediaPlaceholder": function() { return /* reexport */ MediaPlaceholder; },
  1176. "MediaUpload": function() { return /* reexport */ MediaUpload; },
  1177. "MediaUploadCheck": function() { return /* reexport */ MediaUploadCheck; },
  1178. "MultiSelectScrollIntoView": function() { return /* reexport */ MultiSelectScrollIntoView; },
  1179. "NavigableToolbar": function() { return /* reexport */ NavigableToolbar; },
  1180. "ObserveTyping": function() { return /* reexport */ ObserveTyping; },
  1181. "PageAttributesCheck": function() { return /* reexport */ page_attributes_check; },
  1182. "PageAttributesOrder": function() { return /* reexport */ order; },
  1183. "PageAttributesParent": function() { return /* reexport */ page_attributes_parent; },
  1184. "PageTemplate": function() { return /* reexport */ post_template; },
  1185. "PanelColorSettings": function() { return /* reexport */ PanelColorSettings; },
  1186. "PlainText": function() { return /* reexport */ PlainText; },
  1187. "PostAuthor": function() { return /* reexport */ post_author; },
  1188. "PostAuthorCheck": function() { return /* reexport */ PostAuthorCheck; },
  1189. "PostComments": function() { return /* reexport */ post_comments; },
  1190. "PostExcerpt": function() { return /* reexport */ post_excerpt; },
  1191. "PostExcerptCheck": function() { return /* reexport */ post_excerpt_check; },
  1192. "PostFeaturedImage": function() { return /* reexport */ post_featured_image; },
  1193. "PostFeaturedImageCheck": function() { return /* reexport */ post_featured_image_check; },
  1194. "PostFormat": function() { return /* reexport */ PostFormat; },
  1195. "PostFormatCheck": function() { return /* reexport */ post_format_check; },
  1196. "PostLastRevision": function() { return /* reexport */ post_last_revision; },
  1197. "PostLastRevisionCheck": function() { return /* reexport */ post_last_revision_check; },
  1198. "PostLockedModal": function() { return /* reexport */ PostLockedModal; },
  1199. "PostPendingStatus": function() { return /* reexport */ post_pending_status; },
  1200. "PostPendingStatusCheck": function() { return /* reexport */ post_pending_status_check; },
  1201. "PostPingbacks": function() { return /* reexport */ post_pingbacks; },
  1202. "PostPreviewButton": function() { return /* reexport */ post_preview_button; },
  1203. "PostPublishButton": function() { return /* reexport */ post_publish_button; },
  1204. "PostPublishButtonLabel": function() { return /* reexport */ label; },
  1205. "PostPublishPanel": function() { return /* reexport */ post_publish_panel; },
  1206. "PostSavedState": function() { return /* reexport */ PostSavedState; },
  1207. "PostSchedule": function() { return /* reexport */ PostSchedule; },
  1208. "PostScheduleCheck": function() { return /* reexport */ post_schedule_check; },
  1209. "PostScheduleLabel": function() { return /* reexport */ PostScheduleLabel; },
  1210. "PostSlug": function() { return /* reexport */ post_slug; },
  1211. "PostSlugCheck": function() { return /* reexport */ PostSlugCheck; },
  1212. "PostSticky": function() { return /* reexport */ post_sticky; },
  1213. "PostStickyCheck": function() { return /* reexport */ post_sticky_check; },
  1214. "PostSwitchToDraftButton": function() { return /* reexport */ post_switch_to_draft_button; },
  1215. "PostTaxonomies": function() { return /* reexport */ post_taxonomies; },
  1216. "PostTaxonomiesCheck": function() { return /* reexport */ post_taxonomies_check; },
  1217. "PostTaxonomiesFlatTermSelector": function() { return /* reexport */ FlatTermSelector; },
  1218. "PostTaxonomiesHierarchicalTermSelector": function() { return /* reexport */ HierarchicalTermSelector; },
  1219. "PostTextEditor": function() { return /* reexport */ PostTextEditor; },
  1220. "PostTitle": function() { return /* reexport */ post_title; },
  1221. "PostTrash": function() { return /* reexport */ PostTrash; },
  1222. "PostTrashCheck": function() { return /* reexport */ post_trash_check; },
  1223. "PostTypeSupportCheck": function() { return /* reexport */ post_type_support_check; },
  1224. "PostURL": function() { return /* reexport */ PostURL; },
  1225. "PostURLCheck": function() { return /* reexport */ PostURLCheck; },
  1226. "PostURLLabel": function() { return /* reexport */ PostURLLabel; },
  1227. "PostVisibility": function() { return /* reexport */ PostVisibility; },
  1228. "PostVisibilityCheck": function() { return /* reexport */ post_visibility_check; },
  1229. "PostVisibilityLabel": function() { return /* reexport */ PostVisibilityLabel; },
  1230. "RichText": function() { return /* reexport */ RichText; },
  1231. "RichTextShortcut": function() { return /* reexport */ RichTextShortcut; },
  1232. "RichTextToolbarButton": function() { return /* reexport */ RichTextToolbarButton; },
  1233. "ServerSideRender": function() { return /* reexport */ (external_wp_serverSideRender_default()); },
  1234. "SkipToSelectedBlock": function() { return /* reexport */ SkipToSelectedBlock; },
  1235. "TableOfContents": function() { return /* reexport */ table_of_contents; },
  1236. "TextEditorGlobalKeyboardShortcuts": function() { return /* reexport */ TextEditorGlobalKeyboardShortcuts; },
  1237. "ThemeSupportCheck": function() { return /* reexport */ theme_support_check; },
  1238. "URLInput": function() { return /* reexport */ URLInput; },
  1239. "URLInputButton": function() { return /* reexport */ URLInputButton; },
  1240. "URLPopover": function() { return /* reexport */ URLPopover; },
  1241. "UnsavedChangesWarning": function() { return /* reexport */ UnsavedChangesWarning; },
  1242. "VisualEditorGlobalKeyboardShortcuts": function() { return /* reexport */ visual_editor_shortcuts; },
  1243. "Warning": function() { return /* reexport */ Warning; },
  1244. "WordCount": function() { return /* reexport */ WordCount; },
  1245. "WritingFlow": function() { return /* reexport */ WritingFlow; },
  1246. "__unstableRichTextInputEvent": function() { return /* reexport */ __unstableRichTextInputEvent; },
  1247. "cleanForSlug": function() { return /* reexport */ cleanForSlug; },
  1248. "createCustomColorsHOC": function() { return /* reexport */ createCustomColorsHOC; },
  1249. "getColorClassName": function() { return /* reexport */ getColorClassName; },
  1250. "getColorObjectByAttributeValues": function() { return /* reexport */ getColorObjectByAttributeValues; },
  1251. "getColorObjectByColorValue": function() { return /* reexport */ getColorObjectByColorValue; },
  1252. "getFontSize": function() { return /* reexport */ getFontSize; },
  1253. "getFontSizeClass": function() { return /* reexport */ getFontSizeClass; },
  1254. "getTemplatePartIcon": function() { return /* reexport */ getTemplatePartIcon; },
  1255. "mediaUpload": function() { return /* reexport */ mediaUpload; },
  1256. "store": function() { return /* reexport */ store_store; },
  1257. "storeConfig": function() { return /* reexport */ storeConfig; },
  1258. "transformStyles": function() { return /* reexport */ external_wp_blockEditor_namespaceObject.transformStyles; },
  1259. "usePostScheduleLabel": function() { return /* reexport */ usePostScheduleLabel; },
  1260. "usePostURLLabel": function() { return /* reexport */ usePostURLLabel; },
  1261. "usePostVisibilityLabel": function() { return /* reexport */ usePostVisibilityLabel; },
  1262. "userAutocompleter": function() { return /* reexport */ user; },
  1263. "withColorContext": function() { return /* reexport */ withColorContext; },
  1264. "withColors": function() { return /* reexport */ withColors; },
  1265. "withFontSizes": function() { return /* reexport */ withFontSizes; }
  1266. });
  1267. // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js
  1268. var selectors_namespaceObject = {};
  1269. __webpack_require__.r(selectors_namespaceObject);
  1270. __webpack_require__.d(selectors_namespaceObject, {
  1271. "__experimentalGetDefaultTemplatePartAreas": function() { return __experimentalGetDefaultTemplatePartAreas; },
  1272. "__experimentalGetDefaultTemplateType": function() { return __experimentalGetDefaultTemplateType; },
  1273. "__experimentalGetDefaultTemplateTypes": function() { return __experimentalGetDefaultTemplateTypes; },
  1274. "__experimentalGetTemplateInfo": function() { return __experimentalGetTemplateInfo; },
  1275. "__unstableIsEditorReady": function() { return __unstableIsEditorReady; },
  1276. "canInsertBlockType": function() { return canInsertBlockType; },
  1277. "canUserUseUnfilteredHTML": function() { return canUserUseUnfilteredHTML; },
  1278. "didPostSaveRequestFail": function() { return didPostSaveRequestFail; },
  1279. "didPostSaveRequestSucceed": function() { return didPostSaveRequestSucceed; },
  1280. "getActivePostLock": function() { return getActivePostLock; },
  1281. "getAdjacentBlockClientId": function() { return getAdjacentBlockClientId; },
  1282. "getAutosaveAttribute": function() { return getAutosaveAttribute; },
  1283. "getBlock": function() { return getBlock; },
  1284. "getBlockAttributes": function() { return getBlockAttributes; },
  1285. "getBlockCount": function() { return getBlockCount; },
  1286. "getBlockHierarchyRootClientId": function() { return getBlockHierarchyRootClientId; },
  1287. "getBlockIndex": function() { return getBlockIndex; },
  1288. "getBlockInsertionPoint": function() { return getBlockInsertionPoint; },
  1289. "getBlockListSettings": function() { return getBlockListSettings; },
  1290. "getBlockMode": function() { return getBlockMode; },
  1291. "getBlockName": function() { return getBlockName; },
  1292. "getBlockOrder": function() { return getBlockOrder; },
  1293. "getBlockRootClientId": function() { return getBlockRootClientId; },
  1294. "getBlockSelectionEnd": function() { return getBlockSelectionEnd; },
  1295. "getBlockSelectionStart": function() { return getBlockSelectionStart; },
  1296. "getBlocks": function() { return getBlocks; },
  1297. "getBlocksByClientId": function() { return getBlocksByClientId; },
  1298. "getClientIdsOfDescendants": function() { return getClientIdsOfDescendants; },
  1299. "getClientIdsWithDescendants": function() { return getClientIdsWithDescendants; },
  1300. "getCurrentPost": function() { return getCurrentPost; },
  1301. "getCurrentPostAttribute": function() { return getCurrentPostAttribute; },
  1302. "getCurrentPostId": function() { return getCurrentPostId; },
  1303. "getCurrentPostLastRevisionId": function() { return getCurrentPostLastRevisionId; },
  1304. "getCurrentPostRevisionsCount": function() { return getCurrentPostRevisionsCount; },
  1305. "getCurrentPostType": function() { return getCurrentPostType; },
  1306. "getEditedPostAttribute": function() { return getEditedPostAttribute; },
  1307. "getEditedPostContent": function() { return getEditedPostContent; },
  1308. "getEditedPostPreviewLink": function() { return getEditedPostPreviewLink; },
  1309. "getEditedPostSlug": function() { return getEditedPostSlug; },
  1310. "getEditedPostVisibility": function() { return getEditedPostVisibility; },
  1311. "getEditorBlocks": function() { return getEditorBlocks; },
  1312. "getEditorSelection": function() { return getEditorSelection; },
  1313. "getEditorSelectionEnd": function() { return getEditorSelectionEnd; },
  1314. "getEditorSelectionStart": function() { return getEditorSelectionStart; },
  1315. "getEditorSettings": function() { return getEditorSettings; },
  1316. "getFirstMultiSelectedBlockClientId": function() { return getFirstMultiSelectedBlockClientId; },
  1317. "getGlobalBlockCount": function() { return getGlobalBlockCount; },
  1318. "getInserterItems": function() { return getInserterItems; },
  1319. "getLastMultiSelectedBlockClientId": function() { return getLastMultiSelectedBlockClientId; },
  1320. "getMultiSelectedBlockClientIds": function() { return getMultiSelectedBlockClientIds; },
  1321. "getMultiSelectedBlocks": function() { return getMultiSelectedBlocks; },
  1322. "getMultiSelectedBlocksEndClientId": function() { return getMultiSelectedBlocksEndClientId; },
  1323. "getMultiSelectedBlocksStartClientId": function() { return getMultiSelectedBlocksStartClientId; },
  1324. "getNextBlockClientId": function() { return getNextBlockClientId; },
  1325. "getPermalink": function() { return getPermalink; },
  1326. "getPermalinkParts": function() { return getPermalinkParts; },
  1327. "getPostEdits": function() { return getPostEdits; },
  1328. "getPostLockUser": function() { return getPostLockUser; },
  1329. "getPostTypeLabel": function() { return getPostTypeLabel; },
  1330. "getPreviousBlockClientId": function() { return getPreviousBlockClientId; },
  1331. "getSelectedBlock": function() { return getSelectedBlock; },
  1332. "getSelectedBlockClientId": function() { return getSelectedBlockClientId; },
  1333. "getSelectedBlockCount": function() { return getSelectedBlockCount; },
  1334. "getSelectedBlocksInitialCaretPosition": function() { return getSelectedBlocksInitialCaretPosition; },
  1335. "getStateBeforeOptimisticTransaction": function() { return getStateBeforeOptimisticTransaction; },
  1336. "getSuggestedPostFormat": function() { return getSuggestedPostFormat; },
  1337. "getTemplate": function() { return getTemplate; },
  1338. "getTemplateLock": function() { return getTemplateLock; },
  1339. "hasChangedContent": function() { return hasChangedContent; },
  1340. "hasEditorRedo": function() { return hasEditorRedo; },
  1341. "hasEditorUndo": function() { return hasEditorUndo; },
  1342. "hasInserterItems": function() { return hasInserterItems; },
  1343. "hasMultiSelection": function() { return hasMultiSelection; },
  1344. "hasNonPostEntityChanges": function() { return hasNonPostEntityChanges; },
  1345. "hasSelectedBlock": function() { return hasSelectedBlock; },
  1346. "hasSelectedInnerBlock": function() { return hasSelectedInnerBlock; },
  1347. "inSomeHistory": function() { return inSomeHistory; },
  1348. "isAncestorMultiSelected": function() { return isAncestorMultiSelected; },
  1349. "isAutosavingPost": function() { return isAutosavingPost; },
  1350. "isBlockInsertionPointVisible": function() { return isBlockInsertionPointVisible; },
  1351. "isBlockMultiSelected": function() { return isBlockMultiSelected; },
  1352. "isBlockSelected": function() { return isBlockSelected; },
  1353. "isBlockValid": function() { return isBlockValid; },
  1354. "isBlockWithinSelection": function() { return isBlockWithinSelection; },
  1355. "isCaretWithinFormattedText": function() { return isCaretWithinFormattedText; },
  1356. "isCleanNewPost": function() { return isCleanNewPost; },
  1357. "isCurrentPostPending": function() { return isCurrentPostPending; },
  1358. "isCurrentPostPublished": function() { return isCurrentPostPublished; },
  1359. "isCurrentPostScheduled": function() { return isCurrentPostScheduled; },
  1360. "isDeletingPost": function() { return isDeletingPost; },
  1361. "isEditedPostAutosaveable": function() { return isEditedPostAutosaveable; },
  1362. "isEditedPostBeingScheduled": function() { return isEditedPostBeingScheduled; },
  1363. "isEditedPostDateFloating": function() { return isEditedPostDateFloating; },
  1364. "isEditedPostDirty": function() { return isEditedPostDirty; },
  1365. "isEditedPostEmpty": function() { return isEditedPostEmpty; },
  1366. "isEditedPostNew": function() { return isEditedPostNew; },
  1367. "isEditedPostPublishable": function() { return isEditedPostPublishable; },
  1368. "isEditedPostSaveable": function() { return isEditedPostSaveable; },
  1369. "isFirstMultiSelectedBlock": function() { return isFirstMultiSelectedBlock; },
  1370. "isMultiSelecting": function() { return isMultiSelecting; },
  1371. "isPermalinkEditable": function() { return isPermalinkEditable; },
  1372. "isPostAutosavingLocked": function() { return isPostAutosavingLocked; },
  1373. "isPostLockTakeover": function() { return isPostLockTakeover; },
  1374. "isPostLocked": function() { return isPostLocked; },
  1375. "isPostSavingLocked": function() { return isPostSavingLocked; },
  1376. "isPreviewingPost": function() { return isPreviewingPost; },
  1377. "isPublishSidebarEnabled": function() { return isPublishSidebarEnabled; },
  1378. "isPublishingPost": function() { return isPublishingPost; },
  1379. "isSavingNonPostEntityChanges": function() { return isSavingNonPostEntityChanges; },
  1380. "isSavingPost": function() { return isSavingPost; },
  1381. "isSelectionEnabled": function() { return isSelectionEnabled; },
  1382. "isTyping": function() { return isTyping; },
  1383. "isValidTemplate": function() { return isValidTemplate; }
  1384. });
  1385. // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js
  1386. var actions_namespaceObject = {};
  1387. __webpack_require__.r(actions_namespaceObject);
  1388. __webpack_require__.d(actions_namespaceObject, {
  1389. "__experimentalTearDownEditor": function() { return __experimentalTearDownEditor; },
  1390. "autosave": function() { return autosave; },
  1391. "clearSelectedBlock": function() { return clearSelectedBlock; },
  1392. "createUndoLevel": function() { return createUndoLevel; },
  1393. "disablePublishSidebar": function() { return disablePublishSidebar; },
  1394. "editPost": function() { return editPost; },
  1395. "enablePublishSidebar": function() { return enablePublishSidebar; },
  1396. "enterFormattedText": function() { return enterFormattedText; },
  1397. "exitFormattedText": function() { return exitFormattedText; },
  1398. "hideInsertionPoint": function() { return hideInsertionPoint; },
  1399. "insertBlock": function() { return insertBlock; },
  1400. "insertBlocks": function() { return insertBlocks; },
  1401. "insertDefaultBlock": function() { return insertDefaultBlock; },
  1402. "lockPostAutosaving": function() { return lockPostAutosaving; },
  1403. "lockPostSaving": function() { return lockPostSaving; },
  1404. "mergeBlocks": function() { return mergeBlocks; },
  1405. "moveBlockToPosition": function() { return moveBlockToPosition; },
  1406. "moveBlocksDown": function() { return moveBlocksDown; },
  1407. "moveBlocksUp": function() { return moveBlocksUp; },
  1408. "multiSelect": function() { return multiSelect; },
  1409. "receiveBlocks": function() { return receiveBlocks; },
  1410. "redo": function() { return redo; },
  1411. "refreshPost": function() { return refreshPost; },
  1412. "removeBlock": function() { return removeBlock; },
  1413. "removeBlocks": function() { return removeBlocks; },
  1414. "replaceBlock": function() { return replaceBlock; },
  1415. "replaceBlocks": function() { return replaceBlocks; },
  1416. "resetBlocks": function() { return resetBlocks; },
  1417. "resetEditorBlocks": function() { return resetEditorBlocks; },
  1418. "resetPost": function() { return resetPost; },
  1419. "savePost": function() { return savePost; },
  1420. "selectBlock": function() { return selectBlock; },
  1421. "setTemplateValidity": function() { return setTemplateValidity; },
  1422. "setupEditor": function() { return setupEditor; },
  1423. "setupEditorState": function() { return setupEditorState; },
  1424. "showInsertionPoint": function() { return showInsertionPoint; },
  1425. "startMultiSelect": function() { return startMultiSelect; },
  1426. "startTyping": function() { return startTyping; },
  1427. "stopMultiSelect": function() { return stopMultiSelect; },
  1428. "stopTyping": function() { return stopTyping; },
  1429. "synchronizeTemplate": function() { return synchronizeTemplate; },
  1430. "toggleBlockMode": function() { return toggleBlockMode; },
  1431. "toggleSelection": function() { return toggleSelection; },
  1432. "trashPost": function() { return trashPost; },
  1433. "undo": function() { return undo; },
  1434. "unlockPostAutosaving": function() { return unlockPostAutosaving; },
  1435. "unlockPostSaving": function() { return unlockPostSaving; },
  1436. "updateBlock": function() { return updateBlock; },
  1437. "updateBlockAttributes": function() { return updateBlockAttributes; },
  1438. "updateBlockListSettings": function() { return updateBlockListSettings; },
  1439. "updateEditorSettings": function() { return updateEditorSettings; },
  1440. "updatePost": function() { return updatePost; },
  1441. "updatePostLock": function() { return updatePostLock; }
  1442. });
  1443. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  1444. function _extends() {
  1445. _extends = Object.assign ? Object.assign.bind() : function (target) {
  1446. for (var i = 1; i < arguments.length; i++) {
  1447. var source = arguments[i];
  1448. for (var key in source) {
  1449. if (Object.prototype.hasOwnProperty.call(source, key)) {
  1450. target[key] = source[key];
  1451. }
  1452. }
  1453. }
  1454. return target;
  1455. };
  1456. return _extends.apply(this, arguments);
  1457. }
  1458. ;// CONCATENATED MODULE: external ["wp","element"]
  1459. var external_wp_element_namespaceObject = window["wp"]["element"];
  1460. ;// CONCATENATED MODULE: external "lodash"
  1461. var external_lodash_namespaceObject = window["lodash"];
  1462. ;// CONCATENATED MODULE: external ["wp","blocks"]
  1463. var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
  1464. ;// CONCATENATED MODULE: external ["wp","data"]
  1465. var external_wp_data_namespaceObject = window["wp"]["data"];
  1466. ;// CONCATENATED MODULE: external ["wp","coreData"]
  1467. var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
  1468. ;// CONCATENATED MODULE: external ["wp","compose"]
  1469. var external_wp_compose_namespaceObject = window["wp"]["compose"];
  1470. ;// CONCATENATED MODULE: external ["wp","hooks"]
  1471. var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
  1472. ;// CONCATENATED MODULE: external ["wp","blockEditor"]
  1473. var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
  1474. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js
  1475. /**
  1476. * WordPress dependencies
  1477. */
  1478. /**
  1479. * The default post editor settings.
  1480. *
  1481. * @property {boolean|Array} allowedBlockTypes Allowed block types
  1482. * @property {boolean} richEditingEnabled Whether rich editing is enabled or not
  1483. * @property {boolean} codeEditingEnabled Whether code editing is enabled or not
  1484. * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.
  1485. * true = the user has opted to show the Custom Fields panel at the bottom of the editor.
  1486. * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.
  1487. * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed.
  1488. * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API.
  1489. * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage.
  1490. * @property {Array?} availableTemplates The available post templates
  1491. * @property {boolean} disablePostFormats Whether or not the post formats are disabled
  1492. * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions
  1493. * @property {number} maxUploadFileSize Maximum upload file size
  1494. * @property {boolean} supportsLayout Whether the editor supports layouts.
  1495. */
  1496. const EDITOR_SETTINGS_DEFAULTS = { ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS,
  1497. richEditingEnabled: true,
  1498. codeEditingEnabled: true,
  1499. enableCustomFields: undefined,
  1500. supportsLayout: true
  1501. };
  1502. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js
  1503. /**
  1504. * WordPress dependencies
  1505. */
  1506. /**
  1507. * Internal dependencies
  1508. */
  1509. /**
  1510. * Returns a post attribute value, flattening nested rendered content using its
  1511. * raw value in place of its original object form.
  1512. *
  1513. * @param {*} value Original value.
  1514. *
  1515. * @return {*} Raw value.
  1516. */
  1517. function getPostRawValue(value) {
  1518. if (value && 'object' === typeof value && 'raw' in value) {
  1519. return value.raw;
  1520. }
  1521. return value;
  1522. }
  1523. /**
  1524. * Returns true if the two object arguments have the same keys, or false
  1525. * otherwise.
  1526. *
  1527. * @param {Object} a First object.
  1528. * @param {Object} b Second object.
  1529. *
  1530. * @return {boolean} Whether the two objects have the same keys.
  1531. */
  1532. function hasSameKeys(a, b) {
  1533. const keysA = Object.keys(a).sort();
  1534. const keysB = Object.keys(b).sort();
  1535. return keysA.length === keysB.length && keysA.every((key, index) => keysB[index] === key);
  1536. }
  1537. /**
  1538. * Returns true if, given the currently dispatching action and the previously
  1539. * dispatched action, the two actions are editing the same post property, or
  1540. * false otherwise.
  1541. *
  1542. * @param {Object} action Currently dispatching action.
  1543. * @param {Object} previousAction Previously dispatched action.
  1544. *
  1545. * @return {boolean} Whether actions are updating the same post property.
  1546. */
  1547. function isUpdatingSamePostProperty(action, previousAction) {
  1548. return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits);
  1549. }
  1550. /**
  1551. * Returns true if, given the currently dispatching action and the previously
  1552. * dispatched action, the two actions are modifying the same property such that
  1553. * undo history should be batched.
  1554. *
  1555. * @param {Object} action Currently dispatching action.
  1556. * @param {Object} previousAction Previously dispatched action.
  1557. *
  1558. * @return {boolean} Whether to overwrite present state.
  1559. */
  1560. function shouldOverwriteState(action, previousAction) {
  1561. if (action.type === 'RESET_EDITOR_BLOCKS') {
  1562. return !action.shouldCreateUndoLevel;
  1563. }
  1564. if (!previousAction || action.type !== previousAction.type) {
  1565. return false;
  1566. }
  1567. return isUpdatingSamePostProperty(action, previousAction);
  1568. }
  1569. function postId() {
  1570. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  1571. let action = arguments.length > 1 ? arguments[1] : undefined;
  1572. switch (action.type) {
  1573. case 'SETUP_EDITOR_STATE':
  1574. return action.post.id;
  1575. }
  1576. return state;
  1577. }
  1578. function postType() {
  1579. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  1580. let action = arguments.length > 1 ? arguments[1] : undefined;
  1581. switch (action.type) {
  1582. case 'SETUP_EDITOR_STATE':
  1583. return action.post.type;
  1584. }
  1585. return state;
  1586. }
  1587. /**
  1588. * Reducer returning whether the post blocks match the defined template or not.
  1589. *
  1590. * @param {Object} state Current state.
  1591. * @param {Object} action Dispatched action.
  1592. *
  1593. * @return {boolean} Updated state.
  1594. */
  1595. function template() {
  1596. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  1597. isValid: true
  1598. };
  1599. let action = arguments.length > 1 ? arguments[1] : undefined;
  1600. switch (action.type) {
  1601. case 'SET_TEMPLATE_VALIDITY':
  1602. return { ...state,
  1603. isValid: action.isValid
  1604. };
  1605. }
  1606. return state;
  1607. }
  1608. /**
  1609. * Reducer returning current network request state (whether a request to
  1610. * the WP REST API is in progress, successful, or failed).
  1611. *
  1612. * @param {Object} state Current state.
  1613. * @param {Object} action Dispatched action.
  1614. *
  1615. * @return {Object} Updated state.
  1616. */
  1617. function saving() {
  1618. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1619. let action = arguments.length > 1 ? arguments[1] : undefined;
  1620. switch (action.type) {
  1621. case 'REQUEST_POST_UPDATE_START':
  1622. case 'REQUEST_POST_UPDATE_FINISH':
  1623. return {
  1624. pending: action.type === 'REQUEST_POST_UPDATE_START',
  1625. options: action.options || {}
  1626. };
  1627. }
  1628. return state;
  1629. }
  1630. /**
  1631. * Reducer returning deleting post request state.
  1632. *
  1633. * @param {Object} state Current state.
  1634. * @param {Object} action Dispatched action.
  1635. *
  1636. * @return {Object} Updated state.
  1637. */
  1638. function deleting() {
  1639. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1640. let action = arguments.length > 1 ? arguments[1] : undefined;
  1641. switch (action.type) {
  1642. case 'REQUEST_POST_DELETE_START':
  1643. case 'REQUEST_POST_DELETE_FINISH':
  1644. return {
  1645. pending: action.type === 'REQUEST_POST_DELETE_START'
  1646. };
  1647. }
  1648. return state;
  1649. }
  1650. /**
  1651. * Post Lock State.
  1652. *
  1653. * @typedef {Object} PostLockState
  1654. *
  1655. * @property {boolean} isLocked Whether the post is locked.
  1656. * @property {?boolean} isTakeover Whether the post editing has been taken over.
  1657. * @property {?boolean} activePostLock Active post lock value.
  1658. * @property {?Object} user User that took over the post.
  1659. */
  1660. /**
  1661. * Reducer returning the post lock status.
  1662. *
  1663. * @param {PostLockState} state Current state.
  1664. * @param {Object} action Dispatched action.
  1665. *
  1666. * @return {PostLockState} Updated state.
  1667. */
  1668. function postLock() {
  1669. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  1670. isLocked: false
  1671. };
  1672. let action = arguments.length > 1 ? arguments[1] : undefined;
  1673. switch (action.type) {
  1674. case 'UPDATE_POST_LOCK':
  1675. return action.lock;
  1676. }
  1677. return state;
  1678. }
  1679. /**
  1680. * Post saving lock.
  1681. *
  1682. * When post saving is locked, the post cannot be published or updated.
  1683. *
  1684. * @param {PostLockState} state Current state.
  1685. * @param {Object} action Dispatched action.
  1686. *
  1687. * @return {PostLockState} Updated state.
  1688. */
  1689. function postSavingLock() {
  1690. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1691. let action = arguments.length > 1 ? arguments[1] : undefined;
  1692. switch (action.type) {
  1693. case 'LOCK_POST_SAVING':
  1694. return { ...state,
  1695. [action.lockName]: true
  1696. };
  1697. case 'UNLOCK_POST_SAVING':
  1698. {
  1699. const {
  1700. [action.lockName]: removedLockName,
  1701. ...restState
  1702. } = state;
  1703. return restState;
  1704. }
  1705. }
  1706. return state;
  1707. }
  1708. /**
  1709. * Post autosaving lock.
  1710. *
  1711. * When post autosaving is locked, the post will not autosave.
  1712. *
  1713. * @param {PostLockState} state Current state.
  1714. * @param {Object} action Dispatched action.
  1715. *
  1716. * @return {PostLockState} Updated state.
  1717. */
  1718. function postAutosavingLock() {
  1719. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1720. let action = arguments.length > 1 ? arguments[1] : undefined;
  1721. switch (action.type) {
  1722. case 'LOCK_POST_AUTOSAVING':
  1723. return { ...state,
  1724. [action.lockName]: true
  1725. };
  1726. case 'UNLOCK_POST_AUTOSAVING':
  1727. {
  1728. const {
  1729. [action.lockName]: removedLockName,
  1730. ...restState
  1731. } = state;
  1732. return restState;
  1733. }
  1734. }
  1735. return state;
  1736. }
  1737. /**
  1738. * Reducer returning whether the editor is ready to be rendered.
  1739. * The editor is considered ready to be rendered once
  1740. * the post object is loaded properly and the initial blocks parsed.
  1741. *
  1742. * @param {boolean} state
  1743. * @param {Object} action
  1744. *
  1745. * @return {boolean} Updated state.
  1746. */
  1747. function isReady() {
  1748. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  1749. let action = arguments.length > 1 ? arguments[1] : undefined;
  1750. switch (action.type) {
  1751. case 'SETUP_EDITOR_STATE':
  1752. return true;
  1753. case 'TEAR_DOWN_EDITOR':
  1754. return false;
  1755. }
  1756. return state;
  1757. }
  1758. /**
  1759. * Reducer returning the post editor setting.
  1760. *
  1761. * @param {Object} state Current state.
  1762. * @param {Object} action Dispatched action.
  1763. *
  1764. * @return {Object} Updated state.
  1765. */
  1766. function editorSettings() {
  1767. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EDITOR_SETTINGS_DEFAULTS;
  1768. let action = arguments.length > 1 ? arguments[1] : undefined;
  1769. switch (action.type) {
  1770. case 'UPDATE_EDITOR_SETTINGS':
  1771. return { ...state,
  1772. ...action.settings
  1773. };
  1774. }
  1775. return state;
  1776. }
  1777. /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  1778. postId,
  1779. postType,
  1780. saving,
  1781. deleting,
  1782. postLock,
  1783. template,
  1784. postSavingLock,
  1785. isReady,
  1786. editorSettings,
  1787. postAutosavingLock
  1788. }));
  1789. ;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
  1790. /** @typedef {(...args: any[]) => *[]} GetDependants */
  1791. /** @typedef {() => void} Clear */
  1792. /**
  1793. * @typedef {{
  1794. * getDependants: GetDependants,
  1795. * clear: Clear
  1796. * }} EnhancedSelector
  1797. */
  1798. /**
  1799. * Internal cache entry.
  1800. *
  1801. * @typedef CacheNode
  1802. *
  1803. * @property {?CacheNode|undefined} [prev] Previous node.
  1804. * @property {?CacheNode|undefined} [next] Next node.
  1805. * @property {*[]} args Function arguments for cache entry.
  1806. * @property {*} val Function result.
  1807. */
  1808. /**
  1809. * @typedef Cache
  1810. *
  1811. * @property {Clear} clear Function to clear cache.
  1812. * @property {boolean} [isUniqueByDependants] Whether dependants are valid in
  1813. * considering cache uniqueness. A cache is unique if dependents are all arrays
  1814. * or objects.
  1815. * @property {CacheNode?} [head] Cache head.
  1816. * @property {*[]} [lastDependants] Dependants from previous invocation.
  1817. */
  1818. /**
  1819. * Arbitrary value used as key for referencing cache object in WeakMap tree.
  1820. *
  1821. * @type {{}}
  1822. */
  1823. var LEAF_KEY = {};
  1824. /**
  1825. * Returns the first argument as the sole entry in an array.
  1826. *
  1827. * @template T
  1828. *
  1829. * @param {T} value Value to return.
  1830. *
  1831. * @return {[T]} Value returned as entry in array.
  1832. */
  1833. function arrayOf(value) {
  1834. return [value];
  1835. }
  1836. /**
  1837. * Returns true if the value passed is object-like, or false otherwise. A value
  1838. * is object-like if it can support property assignment, e.g. object or array.
  1839. *
  1840. * @param {*} value Value to test.
  1841. *
  1842. * @return {boolean} Whether value is object-like.
  1843. */
  1844. function isObjectLike(value) {
  1845. return !!value && 'object' === typeof value;
  1846. }
  1847. /**
  1848. * Creates and returns a new cache object.
  1849. *
  1850. * @return {Cache} Cache object.
  1851. */
  1852. function createCache() {
  1853. /** @type {Cache} */
  1854. var cache = {
  1855. clear: function () {
  1856. cache.head = null;
  1857. },
  1858. };
  1859. return cache;
  1860. }
  1861. /**
  1862. * Returns true if entries within the two arrays are strictly equal by
  1863. * reference from a starting index.
  1864. *
  1865. * @param {*[]} a First array.
  1866. * @param {*[]} b Second array.
  1867. * @param {number} fromIndex Index from which to start comparison.
  1868. *
  1869. * @return {boolean} Whether arrays are shallowly equal.
  1870. */
  1871. function isShallowEqual(a, b, fromIndex) {
  1872. var i;
  1873. if (a.length !== b.length) {
  1874. return false;
  1875. }
  1876. for (i = fromIndex; i < a.length; i++) {
  1877. if (a[i] !== b[i]) {
  1878. return false;
  1879. }
  1880. }
  1881. return true;
  1882. }
  1883. /**
  1884. * Returns a memoized selector function. The getDependants function argument is
  1885. * called before the memoized selector and is expected to return an immutable
  1886. * reference or array of references on which the selector depends for computing
  1887. * its own return value. The memoize cache is preserved only as long as those
  1888. * dependant references remain the same. If getDependants returns a different
  1889. * reference(s), the cache is cleared and the selector value regenerated.
  1890. *
  1891. * @template {(...args: *[]) => *} S
  1892. *
  1893. * @param {S} selector Selector function.
  1894. * @param {GetDependants=} getDependants Dependant getter returning an array of
  1895. * references used in cache bust consideration.
  1896. */
  1897. /* harmony default export */ function rememo(selector, getDependants) {
  1898. /** @type {WeakMap<*,*>} */
  1899. var rootCache;
  1900. /** @type {GetDependants} */
  1901. var normalizedGetDependants = getDependants ? getDependants : arrayOf;
  1902. /**
  1903. * Returns the cache for a given dependants array. When possible, a WeakMap
  1904. * will be used to create a unique cache for each set of dependants. This
  1905. * is feasible due to the nature of WeakMap in allowing garbage collection
  1906. * to occur on entries where the key object is no longer referenced. Since
  1907. * WeakMap requires the key to be an object, this is only possible when the
  1908. * dependant is object-like. The root cache is created as a hierarchy where
  1909. * each top-level key is the first entry in a dependants set, the value a
  1910. * WeakMap where each key is the next dependant, and so on. This continues
  1911. * so long as the dependants are object-like. If no dependants are object-
  1912. * like, then the cache is shared across all invocations.
  1913. *
  1914. * @see isObjectLike
  1915. *
  1916. * @param {*[]} dependants Selector dependants.
  1917. *
  1918. * @return {Cache} Cache object.
  1919. */
  1920. function getCache(dependants) {
  1921. var caches = rootCache,
  1922. isUniqueByDependants = true,
  1923. i,
  1924. dependant,
  1925. map,
  1926. cache;
  1927. for (i = 0; i < dependants.length; i++) {
  1928. dependant = dependants[i];
  1929. // Can only compose WeakMap from object-like key.
  1930. if (!isObjectLike(dependant)) {
  1931. isUniqueByDependants = false;
  1932. break;
  1933. }
  1934. // Does current segment of cache already have a WeakMap?
  1935. if (caches.has(dependant)) {
  1936. // Traverse into nested WeakMap.
  1937. caches = caches.get(dependant);
  1938. } else {
  1939. // Create, set, and traverse into a new one.
  1940. map = new WeakMap();
  1941. caches.set(dependant, map);
  1942. caches = map;
  1943. }
  1944. }
  1945. // We use an arbitrary (but consistent) object as key for the last item
  1946. // in the WeakMap to serve as our running cache.
  1947. if (!caches.has(LEAF_KEY)) {
  1948. cache = createCache();
  1949. cache.isUniqueByDependants = isUniqueByDependants;
  1950. caches.set(LEAF_KEY, cache);
  1951. }
  1952. return caches.get(LEAF_KEY);
  1953. }
  1954. /**
  1955. * Resets root memoization cache.
  1956. */
  1957. function clear() {
  1958. rootCache = new WeakMap();
  1959. }
  1960. /* eslint-disable jsdoc/check-param-names */
  1961. /**
  1962. * The augmented selector call, considering first whether dependants have
  1963. * changed before passing it to underlying memoize function.
  1964. *
  1965. * @param {*} source Source object for derivation.
  1966. * @param {...*} extraArgs Additional arguments to pass to selector.
  1967. *
  1968. * @return {*} Selector result.
  1969. */
  1970. /* eslint-enable jsdoc/check-param-names */
  1971. function callSelector(/* source, ...extraArgs */) {
  1972. var len = arguments.length,
  1973. cache,
  1974. node,
  1975. i,
  1976. args,
  1977. dependants;
  1978. // Create copy of arguments (avoid leaking deoptimization).
  1979. args = new Array(len);
  1980. for (i = 0; i < len; i++) {
  1981. args[i] = arguments[i];
  1982. }
  1983. dependants = normalizedGetDependants.apply(null, args);
  1984. cache = getCache(dependants);
  1985. // If not guaranteed uniqueness by dependants (primitive type), shallow
  1986. // compare against last dependants and, if references have changed,
  1987. // destroy cache to recalculate result.
  1988. if (!cache.isUniqueByDependants) {
  1989. if (
  1990. cache.lastDependants &&
  1991. !isShallowEqual(dependants, cache.lastDependants, 0)
  1992. ) {
  1993. cache.clear();
  1994. }
  1995. cache.lastDependants = dependants;
  1996. }
  1997. node = cache.head;
  1998. while (node) {
  1999. // Check whether node arguments match arguments
  2000. if (!isShallowEqual(node.args, args, 1)) {
  2001. node = node.next;
  2002. continue;
  2003. }
  2004. // At this point we can assume we've found a match
  2005. // Surface matched node to head if not already
  2006. if (node !== cache.head) {
  2007. // Adjust siblings to point to each other.
  2008. /** @type {CacheNode} */ (node.prev).next = node.next;
  2009. if (node.next) {
  2010. node.next.prev = node.prev;
  2011. }
  2012. node.next = cache.head;
  2013. node.prev = null;
  2014. /** @type {CacheNode} */ (cache.head).prev = node;
  2015. cache.head = node;
  2016. }
  2017. // Return immediately
  2018. return node.val;
  2019. }
  2020. // No cached value found. Continue to insertion phase:
  2021. node = /** @type {CacheNode} */ ({
  2022. // Generate the result from original function
  2023. val: selector.apply(null, args),
  2024. });
  2025. // Avoid including the source object in the cache.
  2026. args[0] = null;
  2027. node.args = args;
  2028. // Don't need to check whether node is already head, since it would
  2029. // have been returned above already if it was
  2030. // Shift existing head down list
  2031. if (cache.head) {
  2032. cache.head.prev = node;
  2033. node.next = cache.head;
  2034. }
  2035. cache.head = node;
  2036. return node.val;
  2037. }
  2038. callSelector.getDependants = normalizedGetDependants;
  2039. callSelector.clear = clear;
  2040. clear();
  2041. return /** @type {S & EnhancedSelector} */ (callSelector);
  2042. }
  2043. ;// CONCATENATED MODULE: external ["wp","date"]
  2044. var external_wp_date_namespaceObject = window["wp"]["date"];
  2045. ;// CONCATENATED MODULE: external ["wp","url"]
  2046. var external_wp_url_namespaceObject = window["wp"]["url"];
  2047. ;// CONCATENATED MODULE: external ["wp","deprecated"]
  2048. var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
  2049. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
  2050. ;// CONCATENATED MODULE: external ["wp","primitives"]
  2051. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  2052. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
  2053. /**
  2054. * WordPress dependencies
  2055. */
  2056. const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2057. xmlns: "http://www.w3.org/2000/svg",
  2058. viewBox: "0 0 24 24"
  2059. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2060. d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
  2061. }));
  2062. /* harmony default export */ var library_layout = (layout);
  2063. ;// CONCATENATED MODULE: external ["wp","preferences"]
  2064. var external_wp_preferences_namespaceObject = window["wp"]["preferences"];
  2065. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js
  2066. /**
  2067. * Set of post properties for which edits should assume a merging behavior,
  2068. * assuming an object value.
  2069. *
  2070. * @type {Set}
  2071. */
  2072. const EDIT_MERGE_PROPERTIES = new Set(['meta']);
  2073. /**
  2074. * Constant for the store module (or reducer) key.
  2075. *
  2076. * @type {string}
  2077. */
  2078. const STORE_NAME = 'core/editor';
  2079. const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID';
  2080. const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
  2081. const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
  2082. const ONE_MINUTE_IN_MS = 60 * 1000;
  2083. const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content'];
  2084. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js
  2085. /**
  2086. * WordPress dependencies
  2087. */
  2088. const header = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2089. xmlns: "http://www.w3.org/2000/svg",
  2090. viewBox: "0 0 24 24"
  2091. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2092. d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
  2093. }));
  2094. /* harmony default export */ var library_header = (header);
  2095. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js
  2096. /**
  2097. * WordPress dependencies
  2098. */
  2099. const footer = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2100. xmlns: "http://www.w3.org/2000/svg",
  2101. viewBox: "0 0 24 24"
  2102. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2103. fillRule: "evenodd",
  2104. d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
  2105. }));
  2106. /* harmony default export */ var library_footer = (footer);
  2107. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js
  2108. /**
  2109. * WordPress dependencies
  2110. */
  2111. const sidebar = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2112. xmlns: "http://www.w3.org/2000/svg",
  2113. viewBox: "0 0 24 24"
  2114. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2115. d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
  2116. }));
  2117. /* harmony default export */ var library_sidebar = (sidebar);
  2118. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
  2119. /**
  2120. * WordPress dependencies
  2121. */
  2122. const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2123. xmlns: "http://www.w3.org/2000/svg",
  2124. viewBox: "0 0 24 24"
  2125. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2126. d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
  2127. }));
  2128. /* harmony default export */ var symbol_filled = (symbolFilled);
  2129. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js
  2130. /**
  2131. * WordPress dependencies
  2132. */
  2133. /**
  2134. * Helper function to retrieve the corresponding icon by name.
  2135. *
  2136. * @param {string} iconName The name of the icon.
  2137. *
  2138. * @return {Object} The corresponding icon.
  2139. */
  2140. function getTemplatePartIcon(iconName) {
  2141. if ('header' === iconName) {
  2142. return library_header;
  2143. } else if ('footer' === iconName) {
  2144. return library_footer;
  2145. } else if ('sidebar' === iconName) {
  2146. return library_sidebar;
  2147. }
  2148. return symbol_filled;
  2149. }
  2150. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js
  2151. /**
  2152. * External dependencies
  2153. */
  2154. /**
  2155. * WordPress dependencies
  2156. */
  2157. /**
  2158. * Internal dependencies
  2159. */
  2160. /**
  2161. * Shared reference to an empty object for cases where it is important to avoid
  2162. * returning a new object reference on every invocation, as in a connected or
  2163. * other pure component which performs `shouldComponentUpdate` check on props.
  2164. * This should be used as a last resort, since the normalized data should be
  2165. * maintained by the reducer result in state.
  2166. */
  2167. const EMPTY_OBJECT = {};
  2168. /**
  2169. * Shared reference to an empty array for cases where it is important to avoid
  2170. * returning a new array reference on every invocation, as in a connected or
  2171. * other pure component which performs `shouldComponentUpdate` check on props.
  2172. * This should be used as a last resort, since the normalized data should be
  2173. * maintained by the reducer result in state.
  2174. */
  2175. const EMPTY_ARRAY = [];
  2176. /**
  2177. * Returns true if any past editor history snapshots exist, or false otherwise.
  2178. *
  2179. * @param {Object} state Global application state.
  2180. *
  2181. * @return {boolean} Whether undo history exists.
  2182. */
  2183. const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2184. return select(external_wp_coreData_namespaceObject.store).hasUndo();
  2185. });
  2186. /**
  2187. * Returns true if any future editor history snapshots exist, or false
  2188. * otherwise.
  2189. *
  2190. * @param {Object} state Global application state.
  2191. *
  2192. * @return {boolean} Whether redo history exists.
  2193. */
  2194. const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2195. return select(external_wp_coreData_namespaceObject.store).hasRedo();
  2196. });
  2197. /**
  2198. * Returns true if the currently edited post is yet to be saved, or false if
  2199. * the post has been saved.
  2200. *
  2201. * @param {Object} state Global application state.
  2202. *
  2203. * @return {boolean} Whether the post is new.
  2204. */
  2205. function isEditedPostNew(state) {
  2206. return getCurrentPost(state).status === 'auto-draft';
  2207. }
  2208. /**
  2209. * Returns true if content includes unsaved changes, or false otherwise.
  2210. *
  2211. * @param {Object} state Editor state.
  2212. *
  2213. * @return {boolean} Whether content includes unsaved changes.
  2214. */
  2215. function hasChangedContent(state) {
  2216. const edits = getPostEdits(state);
  2217. return 'blocks' in edits || // `edits` is intended to contain only values which are different from
  2218. // the saved post, so the mere presence of a property is an indicator
  2219. // that the value is different than what is known to be saved. While
  2220. // content in Visual mode is represented by the blocks state, in Text
  2221. // mode it is tracked by `edits.content`.
  2222. 'content' in edits;
  2223. }
  2224. /**
  2225. * Returns true if there are unsaved values for the current edit session, or
  2226. * false if the editing state matches the saved or new post.
  2227. *
  2228. * @param {Object} state Global application state.
  2229. *
  2230. * @return {boolean} Whether unsaved values exist.
  2231. */
  2232. const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  2233. // Edits should contain only fields which differ from the saved post (reset
  2234. // at initial load and save complete). Thus, a non-empty edits state can be
  2235. // inferred to contain unsaved values.
  2236. const postType = getCurrentPostType(state);
  2237. const postId = getCurrentPostId(state);
  2238. if (select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId)) {
  2239. return true;
  2240. }
  2241. return false;
  2242. });
  2243. /**
  2244. * Returns true if there are unsaved edits for entities other than
  2245. * the editor's post, and false otherwise.
  2246. *
  2247. * @param {Object} state Global application state.
  2248. *
  2249. * @return {boolean} Whether there are edits or not.
  2250. */
  2251. const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  2252. const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords();
  2253. const {
  2254. type,
  2255. id
  2256. } = getCurrentPost(state);
  2257. return dirtyEntityRecords.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
  2258. });
  2259. /**
  2260. * Returns true if there are no unsaved values for the current edit session and
  2261. * if the currently edited post is new (has never been saved before).
  2262. *
  2263. * @param {Object} state Global application state.
  2264. *
  2265. * @return {boolean} Whether new post and unsaved values exist.
  2266. */
  2267. function isCleanNewPost(state) {
  2268. return !isEditedPostDirty(state) && isEditedPostNew(state);
  2269. }
  2270. /**
  2271. * Returns the post currently being edited in its last known saved state, not
  2272. * including unsaved edits. Returns an object containing relevant default post
  2273. * values if the post has not yet been saved.
  2274. *
  2275. * @param {Object} state Global application state.
  2276. *
  2277. * @return {Object} Post object.
  2278. */
  2279. const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  2280. const postId = getCurrentPostId(state);
  2281. const postType = getCurrentPostType(state);
  2282. const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord('postType', postType, postId);
  2283. if (post) {
  2284. return post;
  2285. } // This exists for compatibility with the previous selector behavior
  2286. // which would guarantee an object return based on the editor reducer's
  2287. // default empty object state.
  2288. return EMPTY_OBJECT;
  2289. });
  2290. /**
  2291. * Returns the post type of the post currently being edited.
  2292. *
  2293. * @param {Object} state Global application state.
  2294. *
  2295. * @return {string} Post type.
  2296. */
  2297. function getCurrentPostType(state) {
  2298. return state.postType;
  2299. }
  2300. /**
  2301. * Returns the ID of the post currently being edited, or null if the post has
  2302. * not yet been saved.
  2303. *
  2304. * @param {Object} state Global application state.
  2305. *
  2306. * @return {?number} ID of current post.
  2307. */
  2308. function getCurrentPostId(state) {
  2309. return state.postId;
  2310. }
  2311. /**
  2312. * Returns the number of revisions of the post currently being edited.
  2313. *
  2314. * @param {Object} state Global application state.
  2315. *
  2316. * @return {number} Number of revisions.
  2317. */
  2318. function getCurrentPostRevisionsCount(state) {
  2319. var _getCurrentPost$_link, _getCurrentPost$_link2, _getCurrentPost$_link3, _getCurrentPost$_link4;
  2320. return (_getCurrentPost$_link = (_getCurrentPost$_link2 = getCurrentPost(state)._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : (_getCurrentPost$_link3 = _getCurrentPost$_link2['version-history']) === null || _getCurrentPost$_link3 === void 0 ? void 0 : (_getCurrentPost$_link4 = _getCurrentPost$_link3[0]) === null || _getCurrentPost$_link4 === void 0 ? void 0 : _getCurrentPost$_link4.count) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : 0;
  2321. }
  2322. /**
  2323. * Returns the last revision ID of the post currently being edited,
  2324. * or null if the post has no revisions.
  2325. *
  2326. * @param {Object} state Global application state.
  2327. *
  2328. * @return {?number} ID of the last revision.
  2329. */
  2330. function getCurrentPostLastRevisionId(state) {
  2331. var _getCurrentPost$_link5, _getCurrentPost$_link6, _getCurrentPost$_link7, _getCurrentPost$_link8;
  2332. return (_getCurrentPost$_link5 = (_getCurrentPost$_link6 = getCurrentPost(state)._links) === null || _getCurrentPost$_link6 === void 0 ? void 0 : (_getCurrentPost$_link7 = _getCurrentPost$_link6['predecessor-version']) === null || _getCurrentPost$_link7 === void 0 ? void 0 : (_getCurrentPost$_link8 = _getCurrentPost$_link7[0]) === null || _getCurrentPost$_link8 === void 0 ? void 0 : _getCurrentPost$_link8.id) !== null && _getCurrentPost$_link5 !== void 0 ? _getCurrentPost$_link5 : null;
  2333. }
  2334. /**
  2335. * Returns any post values which have been changed in the editor but not yet
  2336. * been saved.
  2337. *
  2338. * @param {Object} state Global application state.
  2339. *
  2340. * @return {Object} Object of key value pairs comprising unsaved edits.
  2341. */
  2342. const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  2343. const postType = getCurrentPostType(state);
  2344. const postId = getCurrentPostId(state);
  2345. return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT;
  2346. });
  2347. /**
  2348. * Returns an attribute value of the saved post.
  2349. *
  2350. * @param {Object} state Global application state.
  2351. * @param {string} attributeName Post attribute name.
  2352. *
  2353. * @return {*} Post attribute value.
  2354. */
  2355. function getCurrentPostAttribute(state, attributeName) {
  2356. switch (attributeName) {
  2357. case 'type':
  2358. return getCurrentPostType(state);
  2359. case 'id':
  2360. return getCurrentPostId(state);
  2361. default:
  2362. const post = getCurrentPost(state);
  2363. if (!post.hasOwnProperty(attributeName)) {
  2364. break;
  2365. }
  2366. return getPostRawValue(post[attributeName]);
  2367. }
  2368. }
  2369. /**
  2370. * Returns a single attribute of the post being edited, preferring the unsaved
  2371. * edit if one exists, but merging with the attribute value for the last known
  2372. * saved state of the post (this is needed for some nested attributes like meta).
  2373. *
  2374. * @param {Object} state Global application state.
  2375. * @param {string} attributeName Post attribute name.
  2376. *
  2377. * @return {*} Post attribute value.
  2378. */
  2379. const getNestedEditedPostProperty = (state, attributeName) => {
  2380. const edits = getPostEdits(state);
  2381. if (!edits.hasOwnProperty(attributeName)) {
  2382. return getCurrentPostAttribute(state, attributeName);
  2383. }
  2384. return { ...getCurrentPostAttribute(state, attributeName),
  2385. ...edits[attributeName]
  2386. };
  2387. };
  2388. /**
  2389. * Returns a single attribute of the post being edited, preferring the unsaved
  2390. * edit if one exists, but falling back to the attribute for the last known
  2391. * saved state of the post.
  2392. *
  2393. * @param {Object} state Global application state.
  2394. * @param {string} attributeName Post attribute name.
  2395. *
  2396. * @return {*} Post attribute value.
  2397. */
  2398. function getEditedPostAttribute(state, attributeName) {
  2399. // Special cases.
  2400. switch (attributeName) {
  2401. case 'content':
  2402. return getEditedPostContent(state);
  2403. } // Fall back to saved post value if not edited.
  2404. const edits = getPostEdits(state);
  2405. if (!edits.hasOwnProperty(attributeName)) {
  2406. return getCurrentPostAttribute(state, attributeName);
  2407. } // Merge properties are objects which contain only the patch edit in state,
  2408. // and thus must be merged with the current post attribute.
  2409. if (EDIT_MERGE_PROPERTIES.has(attributeName)) {
  2410. return getNestedEditedPostProperty(state, attributeName);
  2411. }
  2412. return edits[attributeName];
  2413. }
  2414. /**
  2415. * Returns an attribute value of the current autosave revision for a post, or
  2416. * null if there is no autosave for the post.
  2417. *
  2418. * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
  2419. * from the '@wordpress/core-data' package and access properties on the returned
  2420. * autosave object using getPostRawValue.
  2421. *
  2422. * @param {Object} state Global application state.
  2423. * @param {string} attributeName Autosave attribute name.
  2424. *
  2425. * @return {*} Autosave attribute value.
  2426. */
  2427. const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, attributeName) => {
  2428. var _select$getCurrentUse;
  2429. if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== 'preview_link') {
  2430. return;
  2431. }
  2432. const postType = getCurrentPostType(state);
  2433. const postId = getCurrentPostId(state);
  2434. const currentUserId = (_select$getCurrentUse = select(external_wp_coreData_namespaceObject.store).getCurrentUser()) === null || _select$getCurrentUse === void 0 ? void 0 : _select$getCurrentUse.id;
  2435. const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId);
  2436. if (autosave) {
  2437. return getPostRawValue(autosave[attributeName]);
  2438. }
  2439. });
  2440. /**
  2441. * Returns the current visibility of the post being edited, preferring the
  2442. * unsaved value if different than the saved post. The return value is one of
  2443. * "private", "password", or "public".
  2444. *
  2445. * @param {Object} state Global application state.
  2446. *
  2447. * @return {string} Post visibility.
  2448. */
  2449. function getEditedPostVisibility(state) {
  2450. const status = getEditedPostAttribute(state, 'status');
  2451. if (status === 'private') {
  2452. return 'private';
  2453. }
  2454. const password = getEditedPostAttribute(state, 'password');
  2455. if (password) {
  2456. return 'password';
  2457. }
  2458. return 'public';
  2459. }
  2460. /**
  2461. * Returns true if post is pending review.
  2462. *
  2463. * @param {Object} state Global application state.
  2464. *
  2465. * @return {boolean} Whether current post is pending review.
  2466. */
  2467. function isCurrentPostPending(state) {
  2468. return getCurrentPost(state).status === 'pending';
  2469. }
  2470. /**
  2471. * Return true if the current post has already been published.
  2472. *
  2473. * @param {Object} state Global application state.
  2474. * @param {Object?} currentPost Explicit current post for bypassing registry selector.
  2475. *
  2476. * @return {boolean} Whether the post has been published.
  2477. */
  2478. function isCurrentPostPublished(state, currentPost) {
  2479. const post = currentPost || getCurrentPost(state);
  2480. return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !(0,external_wp_date_namespaceObject.isInTheFuture)(new Date(Number((0,external_wp_date_namespaceObject.getDate)(post.date)) - ONE_MINUTE_IN_MS));
  2481. }
  2482. /**
  2483. * Returns true if post is already scheduled.
  2484. *
  2485. * @param {Object} state Global application state.
  2486. *
  2487. * @return {boolean} Whether current post is scheduled to be posted.
  2488. */
  2489. function isCurrentPostScheduled(state) {
  2490. return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state);
  2491. }
  2492. /**
  2493. * Return true if the post being edited can be published.
  2494. *
  2495. * @param {Object} state Global application state.
  2496. *
  2497. * @return {boolean} Whether the post can been published.
  2498. */
  2499. function isEditedPostPublishable(state) {
  2500. const post = getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post
  2501. // being saveable. Currently this restriction is imposed at UI.
  2502. //
  2503. // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`).
  2504. return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1;
  2505. }
  2506. /**
  2507. * Returns true if the post can be saved, or false otherwise. A post must
  2508. * contain a title, an excerpt, or non-empty content to be valid for save.
  2509. *
  2510. * @param {Object} state Global application state.
  2511. *
  2512. * @return {boolean} Whether the post can be saved.
  2513. */
  2514. function isEditedPostSaveable(state) {
  2515. if (isSavingPost(state)) {
  2516. return false;
  2517. } // TODO: Post should not be saveable if not dirty. Cannot be added here at
  2518. // this time since posts where meta boxes are present can be saved even if
  2519. // the post is not dirty. Currently this restriction is imposed at UI, but
  2520. // should be moved here.
  2521. //
  2522. // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition)
  2523. // See: <PostSavedState /> (`forceIsDirty` prop)
  2524. // See: <PostPublishButton /> (`forceIsDirty` prop)
  2525. // See: https://github.com/WordPress/gutenberg/pull/4184.
  2526. return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === 'native';
  2527. }
  2528. /**
  2529. * Returns true if the edited post has content. A post has content if it has at
  2530. * least one saveable block or otherwise has a non-empty content property
  2531. * assigned.
  2532. *
  2533. * @param {Object} state Global application state.
  2534. *
  2535. * @return {boolean} Whether post has content.
  2536. */
  2537. function isEditedPostEmpty(state) {
  2538. // While the condition of truthy content string is sufficient to determine
  2539. // emptiness, testing saveable blocks length is a trivial operation. Since
  2540. // this function can be called frequently, optimize for the fast case as a
  2541. // condition of the mere existence of blocks. Note that the value of edited
  2542. // content takes precedent over block content, and must fall through to the
  2543. // default logic.
  2544. const blocks = getEditorBlocks(state);
  2545. if (blocks.length) {
  2546. // Pierce the abstraction of the serializer in knowing that blocks are
  2547. // joined with newlines such that even if every individual block
  2548. // produces an empty save result, the serialized content is non-empty.
  2549. if (blocks.length > 1) {
  2550. return false;
  2551. } // There are two conditions under which the optimization cannot be
  2552. // assumed, and a fallthrough to getEditedPostContent must occur:
  2553. //
  2554. // 1. getBlocksForSerialization has special treatment in omitting a
  2555. // single unmodified default block.
  2556. // 2. Comment delimiters are omitted for a freeform or unregistered
  2557. // block in its serialization. The freeform block specifically may
  2558. // produce an empty string in its saved output.
  2559. //
  2560. // For all other content, the single block is assumed to make a post
  2561. // non-empty, if only by virtue of its own comment delimiters.
  2562. const blockName = blocks[0].name;
  2563. if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) {
  2564. return false;
  2565. }
  2566. }
  2567. return !getEditedPostContent(state);
  2568. }
  2569. /**
  2570. * Returns true if the post can be autosaved, or false otherwise.
  2571. *
  2572. * @param {Object} state Global application state.
  2573. * @param {Object} autosave A raw autosave object from the REST API.
  2574. *
  2575. * @return {boolean} Whether the post can be autosaved.
  2576. */
  2577. const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  2578. var _select$getCurrentUse2;
  2579. // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
  2580. if (!isEditedPostSaveable(state)) {
  2581. return false;
  2582. } // A post is not autosavable when there is a post autosave lock.
  2583. if (isPostAutosavingLocked(state)) {
  2584. return false;
  2585. }
  2586. const postType = getCurrentPostType(state);
  2587. const postId = getCurrentPostId(state);
  2588. const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves(postType, postId);
  2589. const currentUserId = (_select$getCurrentUse2 = select(external_wp_coreData_namespaceObject.store).getCurrentUser()) === null || _select$getCurrentUse2 === void 0 ? void 0 : _select$getCurrentUse2.id; // Disable reason - this line causes the side-effect of fetching the autosave
  2590. // via a resolver, moving below the return would result in the autosave never
  2591. // being fetched.
  2592. // eslint-disable-next-line @wordpress/no-unused-vars-before-return
  2593. const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is
  2594. // unable to determine if the post is autosaveable, so return false.
  2595. if (!hasFetchedAutosave) {
  2596. return false;
  2597. } // If we don't already have an autosave, the post is autosaveable.
  2598. if (!autosave) {
  2599. return true;
  2600. } // To avoid an expensive content serialization, use the content dirtiness
  2601. // flag in place of content field comparison against the known autosave.
  2602. // This is not strictly accurate, and relies on a tolerance toward autosave
  2603. // request failures for unnecessary saves.
  2604. if (hasChangedContent(state)) {
  2605. return true;
  2606. } // If the title or excerpt has changed, the post is autosaveable.
  2607. return ['title', 'excerpt'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field));
  2608. });
  2609. /**
  2610. * Return true if the post being edited is being scheduled. Preferring the
  2611. * unsaved status values.
  2612. *
  2613. * @param {Object} state Global application state.
  2614. *
  2615. * @return {boolean} Whether the post has been published.
  2616. */
  2617. function isEditedPostBeingScheduled(state) {
  2618. const date = getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency).
  2619. const checkedDate = new Date(Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS);
  2620. return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate);
  2621. }
  2622. /**
  2623. * Returns whether the current post should be considered to have a "floating"
  2624. * date (i.e. that it would publish "Immediately" rather than at a set time).
  2625. *
  2626. * Unlike in the PHP backend, the REST API returns a full date string for posts
  2627. * where the 0000-00-00T00:00:00 placeholder is present in the database. To
  2628. * infer that a post is set to publish "Immediately" we check whether the date
  2629. * and modified date are the same.
  2630. *
  2631. * @param {Object} state Editor state.
  2632. *
  2633. * @return {boolean} Whether the edited post has a floating date value.
  2634. */
  2635. function isEditedPostDateFloating(state) {
  2636. const date = getEditedPostAttribute(state, 'date');
  2637. const modified = getEditedPostAttribute(state, 'modified'); // This should be the status of the persisted post
  2638. // It shouldn't use the "edited" status otherwise it breaks the
  2639. // inferred post data floating status
  2640. // See https://github.com/WordPress/gutenberg/issues/28083.
  2641. const status = getCurrentPost(state).status;
  2642. if (status === 'draft' || status === 'auto-draft' || status === 'pending') {
  2643. return date === modified || date === null;
  2644. }
  2645. return false;
  2646. }
  2647. /**
  2648. * Returns true if the post is currently being deleted, or false otherwise.
  2649. *
  2650. * @param {Object} state Editor state.
  2651. *
  2652. * @return {boolean} Whether post is being deleted.
  2653. */
  2654. function isDeletingPost(state) {
  2655. return !!state.deleting.pending;
  2656. }
  2657. /**
  2658. * Returns true if the post is currently being saved, or false otherwise.
  2659. *
  2660. * @param {Object} state Global application state.
  2661. *
  2662. * @return {boolean} Whether post is being saved.
  2663. */
  2664. const isSavingPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  2665. const postType = getCurrentPostType(state);
  2666. const postId = getCurrentPostId(state);
  2667. return select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord('postType', postType, postId);
  2668. });
  2669. /**
  2670. * Returns true if non-post entities are currently being saved, or false otherwise.
  2671. *
  2672. * @param {Object} state Global application state.
  2673. *
  2674. * @return {boolean} Whether non-post entities are being saved.
  2675. */
  2676. const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  2677. const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved();
  2678. const {
  2679. type,
  2680. id
  2681. } = getCurrentPost(state);
  2682. return entitiesBeingSaved.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
  2683. });
  2684. /**
  2685. * Returns true if a previous post save was attempted successfully, or false
  2686. * otherwise.
  2687. *
  2688. * @param {Object} state Global application state.
  2689. *
  2690. * @return {boolean} Whether the post was saved successfully.
  2691. */
  2692. const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  2693. const postType = getCurrentPostType(state);
  2694. const postId = getCurrentPostId(state);
  2695. return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId);
  2696. });
  2697. /**
  2698. * Returns true if a previous post save was attempted but failed, or false
  2699. * otherwise.
  2700. *
  2701. * @param {Object} state Global application state.
  2702. *
  2703. * @return {boolean} Whether the post save failed.
  2704. */
  2705. const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  2706. const postType = getCurrentPostType(state);
  2707. const postId = getCurrentPostId(state);
  2708. return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId);
  2709. });
  2710. /**
  2711. * Returns true if the post is autosaving, or false otherwise.
  2712. *
  2713. * @param {Object} state Global application state.
  2714. *
  2715. * @return {boolean} Whether the post is autosaving.
  2716. */
  2717. function isAutosavingPost(state) {
  2718. var _state$saving$options;
  2719. if (!isSavingPost(state)) {
  2720. return false;
  2721. }
  2722. return Boolean((_state$saving$options = state.saving.options) === null || _state$saving$options === void 0 ? void 0 : _state$saving$options.isAutosave);
  2723. }
  2724. /**
  2725. * Returns true if the post is being previewed, or false otherwise.
  2726. *
  2727. * @param {Object} state Global application state.
  2728. *
  2729. * @return {boolean} Whether the post is being previewed.
  2730. */
  2731. function isPreviewingPost(state) {
  2732. var _state$saving$options2;
  2733. if (!isSavingPost(state)) {
  2734. return false;
  2735. }
  2736. return Boolean((_state$saving$options2 = state.saving.options) === null || _state$saving$options2 === void 0 ? void 0 : _state$saving$options2.isPreview);
  2737. }
  2738. /**
  2739. * Returns the post preview link
  2740. *
  2741. * @param {Object} state Global application state.
  2742. *
  2743. * @return {string?} Preview Link.
  2744. */
  2745. function getEditedPostPreviewLink(state) {
  2746. if (state.saving.pending || isSavingPost(state)) {
  2747. return;
  2748. }
  2749. let previewLink = getAutosaveAttribute(state, 'preview_link'); // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616
  2750. // If the post is draft, ignore the preview link from the autosave record,
  2751. // because the preview could be a stale autosave if the post was switched from
  2752. // published to draft.
  2753. // See: https://github.com/WordPress/gutenberg/pull/37952.
  2754. if (!previewLink || 'draft' === getCurrentPost(state).status) {
  2755. previewLink = getEditedPostAttribute(state, 'link');
  2756. if (previewLink) {
  2757. previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, {
  2758. preview: true
  2759. });
  2760. }
  2761. }
  2762. const featuredImageId = getEditedPostAttribute(state, 'featured_media');
  2763. if (previewLink && featuredImageId) {
  2764. return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, {
  2765. _thumbnail_id: featuredImageId
  2766. });
  2767. }
  2768. return previewLink;
  2769. }
  2770. /**
  2771. * Returns a suggested post format for the current post, inferred only if there
  2772. * is a single block within the post and it is of a type known to match a
  2773. * default post format. Returns null if the format cannot be determined.
  2774. *
  2775. * @param {Object} state Global application state.
  2776. *
  2777. * @return {?string} Suggested post format.
  2778. */
  2779. function getSuggestedPostFormat(state) {
  2780. const blocks = getEditorBlocks(state);
  2781. if (blocks.length > 2) return null;
  2782. let name; // If there is only one block in the content of the post grab its name
  2783. // so we can derive a suitable post format from it.
  2784. if (blocks.length === 1) {
  2785. name = blocks[0].name; // Check for core/embed `video` and `audio` eligible suggestions.
  2786. if (name === 'core/embed') {
  2787. var _blocks$0$attributes;
  2788. const provider = (_blocks$0$attributes = blocks[0].attributes) === null || _blocks$0$attributes === void 0 ? void 0 : _blocks$0$attributes.providerNameSlug;
  2789. if (['youtube', 'vimeo'].includes(provider)) {
  2790. name = 'core/video';
  2791. } else if (['spotify', 'soundcloud'].includes(provider)) {
  2792. name = 'core/audio';
  2793. }
  2794. }
  2795. } // If there are two blocks in the content and the last one is a text blocks
  2796. // grab the name of the first one to also suggest a post format from it.
  2797. if (blocks.length === 2 && blocks[1].name === 'core/paragraph') {
  2798. name = blocks[0].name;
  2799. } // We only convert to default post formats in core.
  2800. switch (name) {
  2801. case 'core/image':
  2802. return 'image';
  2803. case 'core/quote':
  2804. case 'core/pullquote':
  2805. return 'quote';
  2806. case 'core/gallery':
  2807. return 'gallery';
  2808. case 'core/video':
  2809. return 'video';
  2810. case 'core/audio':
  2811. return 'audio';
  2812. default:
  2813. return null;
  2814. }
  2815. }
  2816. /**
  2817. * Returns the content of the post being edited.
  2818. *
  2819. * @param {Object} state Global application state.
  2820. *
  2821. * @return {string} Post content.
  2822. */
  2823. const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  2824. const postId = getCurrentPostId(state);
  2825. const postType = getCurrentPostType(state);
  2826. const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId);
  2827. if (record) {
  2828. if (typeof record.content === 'function') {
  2829. return record.content(record);
  2830. } else if (record.blocks) {
  2831. return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks);
  2832. } else if (record.content) {
  2833. return record.content;
  2834. }
  2835. }
  2836. return '';
  2837. });
  2838. /**
  2839. * Returns true if the post is being published, or false otherwise.
  2840. *
  2841. * @param {Object} state Global application state.
  2842. *
  2843. * @return {boolean} Whether post is being published.
  2844. */
  2845. function isPublishingPost(state) {
  2846. return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish';
  2847. }
  2848. /**
  2849. * Returns whether the permalink is editable or not.
  2850. *
  2851. * @param {Object} state Editor state.
  2852. *
  2853. * @return {boolean} Whether or not the permalink is editable.
  2854. */
  2855. function isPermalinkEditable(state) {
  2856. const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template');
  2857. return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate);
  2858. }
  2859. /**
  2860. * Returns the permalink for the post.
  2861. *
  2862. * @param {Object} state Editor state.
  2863. *
  2864. * @return {?string} The permalink, or null if the post is not viewable.
  2865. */
  2866. function getPermalink(state) {
  2867. const permalinkParts = getPermalinkParts(state);
  2868. if (!permalinkParts) {
  2869. return null;
  2870. }
  2871. const {
  2872. prefix,
  2873. postName,
  2874. suffix
  2875. } = permalinkParts;
  2876. if (isPermalinkEditable(state)) {
  2877. return prefix + postName + suffix;
  2878. }
  2879. return prefix;
  2880. }
  2881. /**
  2882. * Returns the slug for the post being edited, preferring a manually edited
  2883. * value if one exists, then a sanitized version of the current post title, and
  2884. * finally the post ID.
  2885. *
  2886. * @param {Object} state Editor state.
  2887. *
  2888. * @return {string} The current slug to be displayed in the editor
  2889. */
  2890. function getEditedPostSlug(state) {
  2891. return getEditedPostAttribute(state, 'slug') || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state);
  2892. }
  2893. /**
  2894. * Returns the permalink for a post, split into it's three parts: the prefix,
  2895. * the postName, and the suffix.
  2896. *
  2897. * @param {Object} state Editor state.
  2898. *
  2899. * @return {Object} An object containing the prefix, postName, and suffix for
  2900. * the permalink, or null if the post is not viewable.
  2901. */
  2902. function getPermalinkParts(state) {
  2903. const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template');
  2904. if (!permalinkTemplate) {
  2905. return null;
  2906. }
  2907. const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug');
  2908. const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX);
  2909. return {
  2910. prefix,
  2911. postName,
  2912. suffix
  2913. };
  2914. }
  2915. /**
  2916. * Returns whether the post is locked.
  2917. *
  2918. * @param {Object} state Global application state.
  2919. *
  2920. * @return {boolean} Is locked.
  2921. */
  2922. function isPostLocked(state) {
  2923. return state.postLock.isLocked;
  2924. }
  2925. /**
  2926. * Returns whether post saving is locked.
  2927. *
  2928. * @param {Object} state Global application state.
  2929. *
  2930. * @return {boolean} Is locked.
  2931. */
  2932. function isPostSavingLocked(state) {
  2933. return Object.keys(state.postSavingLock).length > 0;
  2934. }
  2935. /**
  2936. * Returns whether post autosaving is locked.
  2937. *
  2938. * @param {Object} state Global application state.
  2939. *
  2940. * @return {boolean} Is locked.
  2941. */
  2942. function isPostAutosavingLocked(state) {
  2943. return Object.keys(state.postAutosavingLock).length > 0;
  2944. }
  2945. /**
  2946. * Returns whether the edition of the post has been taken over.
  2947. *
  2948. * @param {Object} state Global application state.
  2949. *
  2950. * @return {boolean} Is post lock takeover.
  2951. */
  2952. function isPostLockTakeover(state) {
  2953. return state.postLock.isTakeover;
  2954. }
  2955. /**
  2956. * Returns details about the post lock user.
  2957. *
  2958. * @param {Object} state Global application state.
  2959. *
  2960. * @return {Object} A user object.
  2961. */
  2962. function getPostLockUser(state) {
  2963. return state.postLock.user;
  2964. }
  2965. /**
  2966. * Returns the active post lock.
  2967. *
  2968. * @param {Object} state Global application state.
  2969. *
  2970. * @return {Object} The lock object.
  2971. */
  2972. function getActivePostLock(state) {
  2973. return state.postLock.activePostLock;
  2974. }
  2975. /**
  2976. * Returns whether or not the user has the unfiltered_html capability.
  2977. *
  2978. * @param {Object} state Editor state.
  2979. *
  2980. * @return {boolean} Whether the user can or can't post unfiltered HTML.
  2981. */
  2982. function canUserUseUnfilteredHTML(state) {
  2983. var _getCurrentPost$_link9;
  2984. return Boolean((_getCurrentPost$_link9 = getCurrentPost(state)._links) === null || _getCurrentPost$_link9 === void 0 ? void 0 : _getCurrentPost$_link9.hasOwnProperty('wp:action-unfiltered-html'));
  2985. }
  2986. /**
  2987. * Returns whether the pre-publish panel should be shown
  2988. * or skipped when the user clicks the "publish" button.
  2989. *
  2990. * @return {boolean} Whether the pre-publish panel should be shown or not.
  2991. */
  2992. const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'isPublishSidebarEnabled'));
  2993. /**
  2994. * Return the current block list.
  2995. *
  2996. * @param {Object} state
  2997. * @return {Array} Block list.
  2998. */
  2999. function getEditorBlocks(state) {
  3000. return getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY;
  3001. }
  3002. /**
  3003. * A block selection object.
  3004. *
  3005. * @typedef {Object} WPBlockSelection
  3006. *
  3007. * @property {string} clientId A block client ID.
  3008. * @property {string} attributeKey A block attribute key.
  3009. * @property {number} offset An attribute value offset, based on the rich
  3010. * text value. See `wp.richText.create`.
  3011. */
  3012. /**
  3013. * Returns the current selection start.
  3014. *
  3015. * @param {Object} state
  3016. * @return {WPBlockSelection} The selection start.
  3017. *
  3018. * @deprecated since Gutenberg 10.0.0.
  3019. */
  3020. function getEditorSelectionStart(state) {
  3021. var _getEditedPostAttribu;
  3022. external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
  3023. since: '5.8',
  3024. alternative: "select('core/editor').getEditorSelection"
  3025. });
  3026. return (_getEditedPostAttribu = getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu === void 0 ? void 0 : _getEditedPostAttribu.selectionStart;
  3027. }
  3028. /**
  3029. * Returns the current selection end.
  3030. *
  3031. * @param {Object} state
  3032. * @return {WPBlockSelection} The selection end.
  3033. *
  3034. * @deprecated since Gutenberg 10.0.0.
  3035. */
  3036. function getEditorSelectionEnd(state) {
  3037. var _getEditedPostAttribu2;
  3038. external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
  3039. since: '5.8',
  3040. alternative: "select('core/editor').getEditorSelection"
  3041. });
  3042. return (_getEditedPostAttribu2 = getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu2 === void 0 ? void 0 : _getEditedPostAttribu2.selectionEnd;
  3043. }
  3044. /**
  3045. * Returns the current selection.
  3046. *
  3047. * @param {Object} state
  3048. * @return {WPBlockSelection} The selection end.
  3049. */
  3050. function getEditorSelection(state) {
  3051. return getEditedPostAttribute(state, 'selection');
  3052. }
  3053. /**
  3054. * Is the editor ready
  3055. *
  3056. * @param {Object} state
  3057. * @return {boolean} is Ready.
  3058. */
  3059. function __unstableIsEditorReady(state) {
  3060. return state.isReady;
  3061. }
  3062. /**
  3063. * Returns the post editor settings.
  3064. *
  3065. * @param {Object} state Editor state.
  3066. *
  3067. * @return {Object} The editor settings object.
  3068. */
  3069. function getEditorSettings(state) {
  3070. return state.editorSettings;
  3071. }
  3072. /*
  3073. * Backward compatibility
  3074. */
  3075. /**
  3076. * Returns state object prior to a specified optimist transaction ID, or `null`
  3077. * if the transaction corresponding to the given ID cannot be found.
  3078. *
  3079. * @deprecated since Gutenberg 9.7.0.
  3080. */
  3081. function getStateBeforeOptimisticTransaction() {
  3082. external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", {
  3083. since: '5.7',
  3084. hint: 'No state history is kept on this store anymore'
  3085. });
  3086. return null;
  3087. }
  3088. /**
  3089. * Returns true if an optimistic transaction is pending commit, for which the
  3090. * before state satisfies the given predicate function.
  3091. *
  3092. * @deprecated since Gutenberg 9.7.0.
  3093. */
  3094. function inSomeHistory() {
  3095. external_wp_deprecated_default()("select('core/editor').inSomeHistory", {
  3096. since: '5.7',
  3097. hint: 'No state history is kept on this store anymore'
  3098. });
  3099. return false;
  3100. }
  3101. function getBlockEditorSelector(name) {
  3102. return (0,external_wp_data_namespaceObject.createRegistrySelector)(select => function (state) {
  3103. external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', {
  3104. since: '5.3',
  3105. alternative: "`wp.data.select( 'core/block-editor' )." + name + '`',
  3106. version: '6.2'
  3107. });
  3108. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3109. args[_key - 1] = arguments[_key];
  3110. }
  3111. return select(external_wp_blockEditor_namespaceObject.store)[name](...args);
  3112. });
  3113. }
  3114. /**
  3115. * @see getBlockName in core/block-editor store.
  3116. */
  3117. const getBlockName = getBlockEditorSelector('getBlockName');
  3118. /**
  3119. * @see isBlockValid in core/block-editor store.
  3120. */
  3121. const isBlockValid = getBlockEditorSelector('isBlockValid');
  3122. /**
  3123. * @see getBlockAttributes in core/block-editor store.
  3124. */
  3125. const getBlockAttributes = getBlockEditorSelector('getBlockAttributes');
  3126. /**
  3127. * @see getBlock in core/block-editor store.
  3128. */
  3129. const getBlock = getBlockEditorSelector('getBlock');
  3130. /**
  3131. * @see getBlocks in core/block-editor store.
  3132. */
  3133. const getBlocks = getBlockEditorSelector('getBlocks');
  3134. /**
  3135. * @see getClientIdsOfDescendants in core/block-editor store.
  3136. */
  3137. const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants');
  3138. /**
  3139. * @see getClientIdsWithDescendants in core/block-editor store.
  3140. */
  3141. const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants');
  3142. /**
  3143. * @see getGlobalBlockCount in core/block-editor store.
  3144. */
  3145. const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount');
  3146. /**
  3147. * @see getBlocksByClientId in core/block-editor store.
  3148. */
  3149. const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId');
  3150. /**
  3151. * @see getBlockCount in core/block-editor store.
  3152. */
  3153. const getBlockCount = getBlockEditorSelector('getBlockCount');
  3154. /**
  3155. * @see getBlockSelectionStart in core/block-editor store.
  3156. */
  3157. const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart');
  3158. /**
  3159. * @see getBlockSelectionEnd in core/block-editor store.
  3160. */
  3161. const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd');
  3162. /**
  3163. * @see getSelectedBlockCount in core/block-editor store.
  3164. */
  3165. const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount');
  3166. /**
  3167. * @see hasSelectedBlock in core/block-editor store.
  3168. */
  3169. const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock');
  3170. /**
  3171. * @see getSelectedBlockClientId in core/block-editor store.
  3172. */
  3173. const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId');
  3174. /**
  3175. * @see getSelectedBlock in core/block-editor store.
  3176. */
  3177. const getSelectedBlock = getBlockEditorSelector('getSelectedBlock');
  3178. /**
  3179. * @see getBlockRootClientId in core/block-editor store.
  3180. */
  3181. const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId');
  3182. /**
  3183. * @see getBlockHierarchyRootClientId in core/block-editor store.
  3184. */
  3185. const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId');
  3186. /**
  3187. * @see getAdjacentBlockClientId in core/block-editor store.
  3188. */
  3189. const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId');
  3190. /**
  3191. * @see getPreviousBlockClientId in core/block-editor store.
  3192. */
  3193. const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId');
  3194. /**
  3195. * @see getNextBlockClientId in core/block-editor store.
  3196. */
  3197. const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId');
  3198. /**
  3199. * @see getSelectedBlocksInitialCaretPosition in core/block-editor store.
  3200. */
  3201. const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition');
  3202. /**
  3203. * @see getMultiSelectedBlockClientIds in core/block-editor store.
  3204. */
  3205. const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds');
  3206. /**
  3207. * @see getMultiSelectedBlocks in core/block-editor store.
  3208. */
  3209. const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks');
  3210. /**
  3211. * @see getFirstMultiSelectedBlockClientId in core/block-editor store.
  3212. */
  3213. const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId');
  3214. /**
  3215. * @see getLastMultiSelectedBlockClientId in core/block-editor store.
  3216. */
  3217. const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId');
  3218. /**
  3219. * @see isFirstMultiSelectedBlock in core/block-editor store.
  3220. */
  3221. const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock');
  3222. /**
  3223. * @see isBlockMultiSelected in core/block-editor store.
  3224. */
  3225. const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected');
  3226. /**
  3227. * @see isAncestorMultiSelected in core/block-editor store.
  3228. */
  3229. const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected');
  3230. /**
  3231. * @see getMultiSelectedBlocksStartClientId in core/block-editor store.
  3232. */
  3233. const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId');
  3234. /**
  3235. * @see getMultiSelectedBlocksEndClientId in core/block-editor store.
  3236. */
  3237. const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId');
  3238. /**
  3239. * @see getBlockOrder in core/block-editor store.
  3240. */
  3241. const getBlockOrder = getBlockEditorSelector('getBlockOrder');
  3242. /**
  3243. * @see getBlockIndex in core/block-editor store.
  3244. */
  3245. const getBlockIndex = getBlockEditorSelector('getBlockIndex');
  3246. /**
  3247. * @see isBlockSelected in core/block-editor store.
  3248. */
  3249. const isBlockSelected = getBlockEditorSelector('isBlockSelected');
  3250. /**
  3251. * @see hasSelectedInnerBlock in core/block-editor store.
  3252. */
  3253. const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock');
  3254. /**
  3255. * @see isBlockWithinSelection in core/block-editor store.
  3256. */
  3257. const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection');
  3258. /**
  3259. * @see hasMultiSelection in core/block-editor store.
  3260. */
  3261. const hasMultiSelection = getBlockEditorSelector('hasMultiSelection');
  3262. /**
  3263. * @see isMultiSelecting in core/block-editor store.
  3264. */
  3265. const isMultiSelecting = getBlockEditorSelector('isMultiSelecting');
  3266. /**
  3267. * @see isSelectionEnabled in core/block-editor store.
  3268. */
  3269. const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled');
  3270. /**
  3271. * @see getBlockMode in core/block-editor store.
  3272. */
  3273. const getBlockMode = getBlockEditorSelector('getBlockMode');
  3274. /**
  3275. * @see isTyping in core/block-editor store.
  3276. */
  3277. const isTyping = getBlockEditorSelector('isTyping');
  3278. /**
  3279. * @see isCaretWithinFormattedText in core/block-editor store.
  3280. */
  3281. const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText');
  3282. /**
  3283. * @see getBlockInsertionPoint in core/block-editor store.
  3284. */
  3285. const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint');
  3286. /**
  3287. * @see isBlockInsertionPointVisible in core/block-editor store.
  3288. */
  3289. const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible');
  3290. /**
  3291. * @see isValidTemplate in core/block-editor store.
  3292. */
  3293. const isValidTemplate = getBlockEditorSelector('isValidTemplate');
  3294. /**
  3295. * @see getTemplate in core/block-editor store.
  3296. */
  3297. const getTemplate = getBlockEditorSelector('getTemplate');
  3298. /**
  3299. * @see getTemplateLock in core/block-editor store.
  3300. */
  3301. const getTemplateLock = getBlockEditorSelector('getTemplateLock');
  3302. /**
  3303. * @see canInsertBlockType in core/block-editor store.
  3304. */
  3305. const canInsertBlockType = getBlockEditorSelector('canInsertBlockType');
  3306. /**
  3307. * @see getInserterItems in core/block-editor store.
  3308. */
  3309. const getInserterItems = getBlockEditorSelector('getInserterItems');
  3310. /**
  3311. * @see hasInserterItems in core/block-editor store.
  3312. */
  3313. const hasInserterItems = getBlockEditorSelector('hasInserterItems');
  3314. /**
  3315. * @see getBlockListSettings in core/block-editor store.
  3316. */
  3317. const getBlockListSettings = getBlockEditorSelector('getBlockListSettings');
  3318. /**
  3319. * Returns the default template types.
  3320. *
  3321. * @param {Object} state Global application state.
  3322. *
  3323. * @return {Object} The template types.
  3324. */
  3325. function __experimentalGetDefaultTemplateTypes(state) {
  3326. var _getEditorSettings;
  3327. return (_getEditorSettings = getEditorSettings(state)) === null || _getEditorSettings === void 0 ? void 0 : _getEditorSettings.defaultTemplateTypes;
  3328. }
  3329. /**
  3330. * Returns the default template part areas.
  3331. *
  3332. * @param {Object} state Global application state.
  3333. *
  3334. * @return {Array} The template part areas.
  3335. */
  3336. const __experimentalGetDefaultTemplatePartAreas = rememo(state => {
  3337. var _getEditorSettings2;
  3338. const areas = ((_getEditorSettings2 = getEditorSettings(state)) === null || _getEditorSettings2 === void 0 ? void 0 : _getEditorSettings2.defaultTemplatePartAreas) || [];
  3339. return areas === null || areas === void 0 ? void 0 : areas.map(item => {
  3340. return { ...item,
  3341. icon: getTemplatePartIcon(item.icon)
  3342. };
  3343. });
  3344. }, state => {
  3345. var _getEditorSettings3;
  3346. return [(_getEditorSettings3 = getEditorSettings(state)) === null || _getEditorSettings3 === void 0 ? void 0 : _getEditorSettings3.defaultTemplatePartAreas];
  3347. });
  3348. /**
  3349. * Returns a default template type searched by slug.
  3350. *
  3351. * @param {Object} state Global application state.
  3352. * @param {string} slug The template type slug.
  3353. *
  3354. * @return {Object} The template type.
  3355. */
  3356. const __experimentalGetDefaultTemplateType = rememo((state, slug) => {
  3357. var _Object$values$find;
  3358. const templateTypes = __experimentalGetDefaultTemplateTypes(state);
  3359. if (!templateTypes) {
  3360. return EMPTY_OBJECT;
  3361. }
  3362. return (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : EMPTY_OBJECT;
  3363. }, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]);
  3364. /**
  3365. * Given a template entity, return information about it which is ready to be
  3366. * rendered, such as the title, description, and icon.
  3367. *
  3368. * @param {Object} state Global application state.
  3369. * @param {Object} template The template for which we need information.
  3370. * @return {Object} Information about the template, including title, description, and icon.
  3371. */
  3372. function __experimentalGetTemplateInfo(state, template) {
  3373. var _experimentalGetDefa;
  3374. if (!template) {
  3375. return EMPTY_OBJECT;
  3376. }
  3377. const {
  3378. description,
  3379. slug,
  3380. title,
  3381. area
  3382. } = template;
  3383. const {
  3384. title: defaultTitle,
  3385. description: defaultDescription
  3386. } = __experimentalGetDefaultTemplateType(state, slug);
  3387. const templateTitle = typeof title === 'string' ? title : title === null || title === void 0 ? void 0 : title.rendered;
  3388. const templateDescription = typeof description === 'string' ? description : description === null || description === void 0 ? void 0 : description.raw;
  3389. const templateIcon = ((_experimentalGetDefa = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)) === null || _experimentalGetDefa === void 0 ? void 0 : _experimentalGetDefa.icon) || library_layout;
  3390. return {
  3391. title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug,
  3392. description: templateDescription || defaultDescription,
  3393. icon: templateIcon
  3394. };
  3395. }
  3396. /**
  3397. * Returns a post type label depending on the current post.
  3398. *
  3399. * @param {Object} state Global application state.
  3400. *
  3401. * @return {string|undefined} The post type label if available, otherwise undefined.
  3402. */
  3403. const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  3404. var _postType$labels;
  3405. const currentPostType = getCurrentPostType(state);
  3406. const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType); // Disable reason: Post type labels object is shaped like this.
  3407. // eslint-disable-next-line camelcase
  3408. return postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.singular_name;
  3409. });
  3410. ;// CONCATENATED MODULE: external ["wp","apiFetch"]
  3411. var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
  3412. var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
  3413. ;// CONCATENATED MODULE: external ["wp","notices"]
  3414. var external_wp_notices_namespaceObject = window["wp"]["notices"];
  3415. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/local-autosave.js
  3416. /**
  3417. * Function returning a sessionStorage key to set or retrieve a given post's
  3418. * automatic session backup.
  3419. *
  3420. * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's
  3421. * `loggedout` handler can clear sessionStorage of any user-private content.
  3422. *
  3423. * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103
  3424. *
  3425. * @param {string} postId Post ID.
  3426. * @param {boolean} isPostNew Whether post new.
  3427. *
  3428. * @return {string} sessionStorage key
  3429. */
  3430. function postKey(postId, isPostNew) {
  3431. return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`;
  3432. }
  3433. function localAutosaveGet(postId, isPostNew) {
  3434. return window.sessionStorage.getItem(postKey(postId, isPostNew));
  3435. }
  3436. function localAutosaveSet(postId, isPostNew, title, content, excerpt) {
  3437. window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({
  3438. post_title: title,
  3439. content,
  3440. excerpt
  3441. }));
  3442. }
  3443. function localAutosaveClear(postId, isPostNew) {
  3444. window.sessionStorage.removeItem(postKey(postId, isPostNew));
  3445. }
  3446. ;// CONCATENATED MODULE: external ["wp","i18n"]
  3447. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  3448. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js
  3449. /**
  3450. * WordPress dependencies
  3451. */
  3452. /**
  3453. * Internal dependencies
  3454. */
  3455. /**
  3456. * External dependencies
  3457. */
  3458. /**
  3459. * Builds the arguments for a success notification dispatch.
  3460. *
  3461. * @param {Object} data Incoming data to build the arguments from.
  3462. *
  3463. * @return {Array} Arguments for dispatch. An empty array signals no
  3464. * notification should be sent.
  3465. */
  3466. function getNotificationArgumentsForSaveSuccess(data) {
  3467. const {
  3468. previousPost,
  3469. post,
  3470. postType
  3471. } = data; // Autosaves are neither shown a notice nor redirected.
  3472. if ((0,external_lodash_namespaceObject.get)(data.options, ['isAutosave'])) {
  3473. return [];
  3474. } // No notice is shown after trashing a post
  3475. if (post.status === 'trash' && previousPost.status !== 'trash') {
  3476. return [];
  3477. }
  3478. const publishStatus = ['publish', 'private', 'future'];
  3479. const isPublished = (0,external_lodash_namespaceObject.includes)(publishStatus, previousPost.status);
  3480. const willPublish = (0,external_lodash_namespaceObject.includes)(publishStatus, post.status);
  3481. let noticeMessage;
  3482. let shouldShowLink = (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false);
  3483. let isDraft; // Always should a notice, which will be spoken for accessibility.
  3484. if (!isPublished && !willPublish) {
  3485. // If saving a non-published post, don't show notice.
  3486. noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved.');
  3487. isDraft = true;
  3488. } else if (isPublished && !willPublish) {
  3489. // If undoing publish status, show specific notice.
  3490. noticeMessage = postType.labels.item_reverted_to_draft;
  3491. shouldShowLink = false;
  3492. } else if (!isPublished && willPublish) {
  3493. // If publishing or scheduling a post, show the corresponding
  3494. // publish message.
  3495. noticeMessage = {
  3496. publish: postType.labels.item_published,
  3497. private: postType.labels.item_published_privately,
  3498. future: postType.labels.item_scheduled
  3499. }[post.status];
  3500. } else {
  3501. // Generic fallback notice.
  3502. noticeMessage = postType.labels.item_updated;
  3503. }
  3504. const actions = [];
  3505. if (shouldShowLink) {
  3506. actions.push({
  3507. label: isDraft ? (0,external_wp_i18n_namespaceObject.__)('View Preview') : postType.labels.view_item,
  3508. url: post.link
  3509. });
  3510. }
  3511. return [noticeMessage, {
  3512. id: SAVE_POST_NOTICE_ID,
  3513. type: 'snackbar',
  3514. actions
  3515. }];
  3516. }
  3517. /**
  3518. * Builds the fail notification arguments for dispatch.
  3519. *
  3520. * @param {Object} data Incoming data to build the arguments with.
  3521. *
  3522. * @return {Array} Arguments for dispatch. An empty array signals no
  3523. * notification should be sent.
  3524. */
  3525. function getNotificationArgumentsForSaveFail(data) {
  3526. const {
  3527. post,
  3528. edits,
  3529. error
  3530. } = data;
  3531. if (error && 'rest_autosave_no_changes' === error.code) {
  3532. // Autosave requested a new autosave, but there were no changes. This shouldn't
  3533. // result in an error notice for the user.
  3534. return [];
  3535. }
  3536. const publishStatus = ['publish', 'private', 'future'];
  3537. const isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message
  3538. // Unless we publish an "updating failed" message.
  3539. const messages = {
  3540. publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'),
  3541. private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'),
  3542. future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.')
  3543. };
  3544. let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.'); // Check if message string contains HTML. Notice text is currently only
  3545. // supported as plaintext, and stripping the tags may muddle the meaning.
  3546. if (error.message && !/<\/?[^>]*>/.test(error.message)) {
  3547. noticeMessage = [noticeMessage, error.message].join(' ');
  3548. }
  3549. return [noticeMessage, {
  3550. id: SAVE_POST_NOTICE_ID
  3551. }];
  3552. }
  3553. /**
  3554. * Builds the trash fail notification arguments for dispatch.
  3555. *
  3556. * @param {Object} data
  3557. *
  3558. * @return {Array} Arguments for dispatch.
  3559. */
  3560. function getNotificationArgumentsForTrashFail(data) {
  3561. return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), {
  3562. id: TRASH_POST_NOTICE_ID
  3563. }];
  3564. }
  3565. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js
  3566. /**
  3567. * WordPress dependencies
  3568. */
  3569. /**
  3570. * Internal dependencies
  3571. */
  3572. /**
  3573. * Returns an action generator used in signalling that editor has initialized with
  3574. * the specified post object and editor settings.
  3575. *
  3576. * @param {Object} post Post object.
  3577. * @param {Object} edits Initial edited attributes object.
  3578. * @param {Array?} template Block Template.
  3579. */
  3580. const setupEditor = (post, edits, template) => _ref => {
  3581. let {
  3582. dispatch
  3583. } = _ref;
  3584. dispatch.setupEditorState(post); // Apply a template for new posts only, if exists.
  3585. const isNewPost = post.status === 'auto-draft';
  3586. if (isNewPost && template) {
  3587. // In order to ensure maximum of a single parse during setup, edits are
  3588. // included as part of editor setup action. Assume edited content as
  3589. // canonical if provided, falling back to post.
  3590. let content;
  3591. if ('content' in edits) {
  3592. content = edits.content;
  3593. } else {
  3594. content = post.content.raw;
  3595. }
  3596. let blocks = (0,external_wp_blocks_namespaceObject.parse)(content);
  3597. blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template);
  3598. dispatch.resetEditorBlocks(blocks, {
  3599. __unstableShouldCreateUndoLevel: false
  3600. });
  3601. }
  3602. if (edits && Object.values(edits).some(_ref2 => {
  3603. var _post$key$raw, _post$key;
  3604. let [key, edit] = _ref2;
  3605. return edit !== ((_post$key$raw = (_post$key = post[key]) === null || _post$key === void 0 ? void 0 : _post$key.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]);
  3606. })) {
  3607. dispatch.editPost(edits);
  3608. }
  3609. };
  3610. /**
  3611. * Returns an action object signalling that the editor is being destroyed and
  3612. * that any necessary state or side-effect cleanup should occur.
  3613. *
  3614. * @return {Object} Action object.
  3615. */
  3616. function __experimentalTearDownEditor() {
  3617. return {
  3618. type: 'TEAR_DOWN_EDITOR'
  3619. };
  3620. }
  3621. /**
  3622. * Returns an action object used in signalling that the latest version of the
  3623. * post has been received, either by initialization or save.
  3624. *
  3625. * @deprecated Since WordPress 6.0.
  3626. */
  3627. function resetPost() {
  3628. external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", {
  3629. since: '6.0',
  3630. version: '6.3',
  3631. alternative: 'Initialize the editor with the setupEditorState action'
  3632. });
  3633. return {
  3634. type: 'DO_NOTHING'
  3635. };
  3636. }
  3637. /**
  3638. * Returns an action object used in signalling that a patch of updates for the
  3639. * latest version of the post have been received.
  3640. *
  3641. * @return {Object} Action object.
  3642. * @deprecated since Gutenberg 9.7.0.
  3643. */
  3644. function updatePost() {
  3645. external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", {
  3646. since: '5.7',
  3647. alternative: 'Use the core entities store instead'
  3648. });
  3649. return {
  3650. type: 'DO_NOTHING'
  3651. };
  3652. }
  3653. /**
  3654. * Returns an action object used to setup the editor state when first opening
  3655. * an editor.
  3656. *
  3657. * @param {Object} post Post object.
  3658. *
  3659. * @return {Object} Action object.
  3660. */
  3661. function setupEditorState(post) {
  3662. return {
  3663. type: 'SETUP_EDITOR_STATE',
  3664. post
  3665. };
  3666. }
  3667. /**
  3668. * Returns an action object used in signalling that attributes of the post have
  3669. * been edited.
  3670. *
  3671. * @param {Object} edits Post attributes to edit.
  3672. * @param {Object} options Options for the edit.
  3673. */
  3674. const editPost = (edits, options) => _ref3 => {
  3675. let {
  3676. select,
  3677. registry
  3678. } = _ref3;
  3679. const {
  3680. id,
  3681. type
  3682. } = select.getCurrentPost();
  3683. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', type, id, edits, options);
  3684. };
  3685. /**
  3686. * Action for saving the current post in the editor.
  3687. *
  3688. * @param {Object} options
  3689. */
  3690. const savePost = function () {
  3691. let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  3692. return async _ref4 => {
  3693. let {
  3694. select,
  3695. dispatch,
  3696. registry
  3697. } = _ref4;
  3698. if (!select.isEditedPostSaveable()) {
  3699. return;
  3700. }
  3701. const content = select.getEditedPostContent();
  3702. if (!options.isAutosave) {
  3703. dispatch.editPost({
  3704. content
  3705. }, {
  3706. undoIgnore: true
  3707. });
  3708. }
  3709. const previousRecord = select.getCurrentPost();
  3710. const edits = {
  3711. id: previousRecord.id,
  3712. ...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id),
  3713. content
  3714. };
  3715. dispatch({
  3716. type: 'REQUEST_POST_UPDATE_START',
  3717. options
  3718. });
  3719. await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', previousRecord.type, edits, options);
  3720. dispatch({
  3721. type: 'REQUEST_POST_UPDATE_FINISH',
  3722. options
  3723. });
  3724. const error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id);
  3725. if (error) {
  3726. const args = getNotificationArgumentsForSaveFail({
  3727. post: previousRecord,
  3728. edits,
  3729. error
  3730. });
  3731. if (args.length) {
  3732. registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args);
  3733. }
  3734. } else {
  3735. const updatedRecord = select.getCurrentPost();
  3736. const args = getNotificationArgumentsForSaveSuccess({
  3737. previousPost: previousRecord,
  3738. post: updatedRecord,
  3739. postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type),
  3740. options
  3741. });
  3742. if (args.length) {
  3743. registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args);
  3744. } // Make sure that any edits after saving create an undo level and are
  3745. // considered for change detection.
  3746. if (!options.isAutosave) {
  3747. registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent();
  3748. }
  3749. }
  3750. };
  3751. };
  3752. /**
  3753. * Action for refreshing the current post.
  3754. *
  3755. * @deprecated Since WordPress 6.0.
  3756. */
  3757. function refreshPost() {
  3758. external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", {
  3759. since: '6.0',
  3760. version: '6.3',
  3761. alternative: 'Use the core entities store instead'
  3762. });
  3763. return {
  3764. type: 'DO_NOTHING'
  3765. };
  3766. }
  3767. /**
  3768. * Action for trashing the current post in the editor.
  3769. */
  3770. const trashPost = () => async _ref5 => {
  3771. let {
  3772. select,
  3773. dispatch,
  3774. registry
  3775. } = _ref5;
  3776. const postTypeSlug = select.getCurrentPostType();
  3777. const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
  3778. registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(TRASH_POST_NOTICE_ID);
  3779. const {
  3780. rest_base: restBase,
  3781. rest_namespace: restNamespace = 'wp/v2'
  3782. } = postType;
  3783. dispatch({
  3784. type: 'REQUEST_POST_DELETE_START'
  3785. });
  3786. try {
  3787. const post = select.getCurrentPost();
  3788. await external_wp_apiFetch_default()({
  3789. path: `/${restNamespace}/${restBase}/${post.id}`,
  3790. method: 'DELETE'
  3791. });
  3792. await dispatch.savePost();
  3793. } catch (error) {
  3794. registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...getNotificationArgumentsForTrashFail({
  3795. error
  3796. }));
  3797. }
  3798. dispatch({
  3799. type: 'REQUEST_POST_DELETE_FINISH'
  3800. });
  3801. };
  3802. /**
  3803. * Action that autosaves the current post. This
  3804. * includes server-side autosaving (default) and client-side (a.k.a. local)
  3805. * autosaving (e.g. on the Web, the post might be committed to Session
  3806. * Storage).
  3807. *
  3808. * @param {Object?} options Extra flags to identify the autosave.
  3809. */
  3810. const autosave = function () {
  3811. let {
  3812. local = false,
  3813. ...options
  3814. } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  3815. return async _ref6 => {
  3816. let {
  3817. select,
  3818. dispatch
  3819. } = _ref6;
  3820. if (local) {
  3821. const post = select.getCurrentPost();
  3822. const isPostNew = select.isEditedPostNew();
  3823. const title = select.getEditedPostAttribute('title');
  3824. const content = select.getEditedPostAttribute('content');
  3825. const excerpt = select.getEditedPostAttribute('excerpt');
  3826. localAutosaveSet(post.id, isPostNew, title, content, excerpt);
  3827. } else {
  3828. await dispatch.savePost({
  3829. isAutosave: true,
  3830. ...options
  3831. });
  3832. }
  3833. };
  3834. };
  3835. /**
  3836. * Action that restores last popped state in undo history.
  3837. */
  3838. const redo = () => _ref7 => {
  3839. let {
  3840. registry
  3841. } = _ref7;
  3842. registry.dispatch(external_wp_coreData_namespaceObject.store).redo();
  3843. };
  3844. /**
  3845. * Action that pops a record from undo history and undoes the edit.
  3846. */
  3847. const undo = () => _ref8 => {
  3848. let {
  3849. registry
  3850. } = _ref8;
  3851. registry.dispatch(external_wp_coreData_namespaceObject.store).undo();
  3852. };
  3853. /**
  3854. * Action that creates an undo history record.
  3855. *
  3856. * @deprecated Since WordPress 6.0
  3857. */
  3858. function createUndoLevel() {
  3859. external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", {
  3860. since: '6.0',
  3861. version: '6.3',
  3862. alternative: 'Use the core entities store instead'
  3863. });
  3864. return {
  3865. type: 'DO_NOTHING'
  3866. };
  3867. }
  3868. /**
  3869. * Action that locks the editor.
  3870. *
  3871. * @param {Object} lock Details about the post lock status, user, and nonce.
  3872. * @return {Object} Action object.
  3873. */
  3874. function updatePostLock(lock) {
  3875. return {
  3876. type: 'UPDATE_POST_LOCK',
  3877. lock
  3878. };
  3879. }
  3880. /**
  3881. * Enable the publish sidebar.
  3882. */
  3883. const enablePublishSidebar = () => _ref9 => {
  3884. let {
  3885. registry
  3886. } = _ref9;
  3887. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'isPublishSidebarEnabled', true);
  3888. };
  3889. /**
  3890. * Disables the publish sidebar.
  3891. */
  3892. const disablePublishSidebar = () => _ref10 => {
  3893. let {
  3894. registry
  3895. } = _ref10;
  3896. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'isPublishSidebarEnabled', false);
  3897. };
  3898. /**
  3899. * Action that locks post saving.
  3900. *
  3901. * @param {string} lockName The lock name.
  3902. *
  3903. * @example
  3904. * ```
  3905. * const { subscribe } = wp.data;
  3906. *
  3907. * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
  3908. *
  3909. * // Only allow publishing posts that are set to a future date.
  3910. * if ( 'publish' !== initialPostStatus ) {
  3911. *
  3912. * // Track locking.
  3913. * let locked = false;
  3914. *
  3915. * // Watch for the publish event.
  3916. * let unssubscribe = subscribe( () => {
  3917. * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
  3918. * if ( 'publish' !== currentPostStatus ) {
  3919. *
  3920. * // Compare the post date to the current date, lock the post if the date isn't in the future.
  3921. * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );
  3922. * const currentDate = new Date();
  3923. * if ( postDate.getTime() <= currentDate.getTime() ) {
  3924. * if ( ! locked ) {
  3925. * locked = true;
  3926. * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );
  3927. * }
  3928. * } else {
  3929. * if ( locked ) {
  3930. * locked = false;
  3931. * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );
  3932. * }
  3933. * }
  3934. * }
  3935. * } );
  3936. * }
  3937. * ```
  3938. *
  3939. * @return {Object} Action object
  3940. */
  3941. function lockPostSaving(lockName) {
  3942. return {
  3943. type: 'LOCK_POST_SAVING',
  3944. lockName
  3945. };
  3946. }
  3947. /**
  3948. * Action that unlocks post saving.
  3949. *
  3950. * @param {string} lockName The lock name.
  3951. *
  3952. * @example
  3953. * ```
  3954. * // Unlock post saving with the lock key `mylock`:
  3955. * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );
  3956. * ```
  3957. *
  3958. * @return {Object} Action object
  3959. */
  3960. function unlockPostSaving(lockName) {
  3961. return {
  3962. type: 'UNLOCK_POST_SAVING',
  3963. lockName
  3964. };
  3965. }
  3966. /**
  3967. * Action that locks post autosaving.
  3968. *
  3969. * @param {string} lockName The lock name.
  3970. *
  3971. * @example
  3972. * ```
  3973. * // Lock post autosaving with the lock key `mylock`:
  3974. * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );
  3975. * ```
  3976. *
  3977. * @return {Object} Action object
  3978. */
  3979. function lockPostAutosaving(lockName) {
  3980. return {
  3981. type: 'LOCK_POST_AUTOSAVING',
  3982. lockName
  3983. };
  3984. }
  3985. /**
  3986. * Action that unlocks post autosaving.
  3987. *
  3988. * @param {string} lockName The lock name.
  3989. *
  3990. * @example
  3991. * ```
  3992. * // Unlock post saving with the lock key `mylock`:
  3993. * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );
  3994. * ```
  3995. *
  3996. * @return {Object} Action object
  3997. */
  3998. function unlockPostAutosaving(lockName) {
  3999. return {
  4000. type: 'UNLOCK_POST_AUTOSAVING',
  4001. lockName
  4002. };
  4003. }
  4004. /**
  4005. * Returns an action object used to signal that the blocks have been updated.
  4006. *
  4007. * @param {Array} blocks Block Array.
  4008. * @param {?Object} options Optional options.
  4009. */
  4010. const resetEditorBlocks = function (blocks) {
  4011. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4012. return _ref11 => {
  4013. let {
  4014. select,
  4015. dispatch,
  4016. registry
  4017. } = _ref11;
  4018. const {
  4019. __unstableShouldCreateUndoLevel,
  4020. selection
  4021. } = options;
  4022. const edits = {
  4023. blocks,
  4024. selection
  4025. };
  4026. if (__unstableShouldCreateUndoLevel !== false) {
  4027. const {
  4028. id,
  4029. type
  4030. } = select.getCurrentPost();
  4031. const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks;
  4032. if (noChange) {
  4033. registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel('postType', type, id);
  4034. return;
  4035. } // We create a new function here on every persistent edit
  4036. // to make sure the edit makes the post dirty and creates
  4037. // a new undo level.
  4038. edits.content = _ref12 => {
  4039. let {
  4040. blocks: blocksForSerialization = []
  4041. } = _ref12;
  4042. return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization);
  4043. };
  4044. }
  4045. dispatch.editPost(edits);
  4046. };
  4047. };
  4048. /*
  4049. * Returns an action object used in signalling that the post editor settings have been updated.
  4050. *
  4051. * @param {Object} settings Updated settings
  4052. *
  4053. * @return {Object} Action object
  4054. */
  4055. function updateEditorSettings(settings) {
  4056. return {
  4057. type: 'UPDATE_EDITOR_SETTINGS',
  4058. settings
  4059. };
  4060. }
  4061. /**
  4062. * Backward compatibility
  4063. */
  4064. const getBlockEditorAction = name => function () {
  4065. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  4066. args[_key] = arguments[_key];
  4067. }
  4068. return _ref13 => {
  4069. let {
  4070. registry
  4071. } = _ref13;
  4072. external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', {
  4073. since: '5.3',
  4074. alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
  4075. version: '6.2'
  4076. });
  4077. registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args);
  4078. };
  4079. };
  4080. /**
  4081. * @see resetBlocks in core/block-editor store.
  4082. */
  4083. const resetBlocks = getBlockEditorAction('resetBlocks');
  4084. /**
  4085. * @see receiveBlocks in core/block-editor store.
  4086. */
  4087. const receiveBlocks = getBlockEditorAction('receiveBlocks');
  4088. /**
  4089. * @see updateBlock in core/block-editor store.
  4090. */
  4091. const updateBlock = getBlockEditorAction('updateBlock');
  4092. /**
  4093. * @see updateBlockAttributes in core/block-editor store.
  4094. */
  4095. const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes');
  4096. /**
  4097. * @see selectBlock in core/block-editor store.
  4098. */
  4099. const selectBlock = getBlockEditorAction('selectBlock');
  4100. /**
  4101. * @see startMultiSelect in core/block-editor store.
  4102. */
  4103. const startMultiSelect = getBlockEditorAction('startMultiSelect');
  4104. /**
  4105. * @see stopMultiSelect in core/block-editor store.
  4106. */
  4107. const stopMultiSelect = getBlockEditorAction('stopMultiSelect');
  4108. /**
  4109. * @see multiSelect in core/block-editor store.
  4110. */
  4111. const multiSelect = getBlockEditorAction('multiSelect');
  4112. /**
  4113. * @see clearSelectedBlock in core/block-editor store.
  4114. */
  4115. const clearSelectedBlock = getBlockEditorAction('clearSelectedBlock');
  4116. /**
  4117. * @see toggleSelection in core/block-editor store.
  4118. */
  4119. const toggleSelection = getBlockEditorAction('toggleSelection');
  4120. /**
  4121. * @see replaceBlocks in core/block-editor store.
  4122. */
  4123. const replaceBlocks = getBlockEditorAction('replaceBlocks');
  4124. /**
  4125. * @see replaceBlock in core/block-editor store.
  4126. */
  4127. const replaceBlock = getBlockEditorAction('replaceBlock');
  4128. /**
  4129. * @see moveBlocksDown in core/block-editor store.
  4130. */
  4131. const moveBlocksDown = getBlockEditorAction('moveBlocksDown');
  4132. /**
  4133. * @see moveBlocksUp in core/block-editor store.
  4134. */
  4135. const moveBlocksUp = getBlockEditorAction('moveBlocksUp');
  4136. /**
  4137. * @see moveBlockToPosition in core/block-editor store.
  4138. */
  4139. const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition');
  4140. /**
  4141. * @see insertBlock in core/block-editor store.
  4142. */
  4143. const insertBlock = getBlockEditorAction('insertBlock');
  4144. /**
  4145. * @see insertBlocks in core/block-editor store.
  4146. */
  4147. const insertBlocks = getBlockEditorAction('insertBlocks');
  4148. /**
  4149. * @see showInsertionPoint in core/block-editor store.
  4150. */
  4151. const showInsertionPoint = getBlockEditorAction('showInsertionPoint');
  4152. /**
  4153. * @see hideInsertionPoint in core/block-editor store.
  4154. */
  4155. const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint');
  4156. /**
  4157. * @see setTemplateValidity in core/block-editor store.
  4158. */
  4159. const setTemplateValidity = getBlockEditorAction('setTemplateValidity');
  4160. /**
  4161. * @see synchronizeTemplate in core/block-editor store.
  4162. */
  4163. const synchronizeTemplate = getBlockEditorAction('synchronizeTemplate');
  4164. /**
  4165. * @see mergeBlocks in core/block-editor store.
  4166. */
  4167. const mergeBlocks = getBlockEditorAction('mergeBlocks');
  4168. /**
  4169. * @see removeBlocks in core/block-editor store.
  4170. */
  4171. const removeBlocks = getBlockEditorAction('removeBlocks');
  4172. /**
  4173. * @see removeBlock in core/block-editor store.
  4174. */
  4175. const removeBlock = getBlockEditorAction('removeBlock');
  4176. /**
  4177. * @see toggleBlockMode in core/block-editor store.
  4178. */
  4179. const toggleBlockMode = getBlockEditorAction('toggleBlockMode');
  4180. /**
  4181. * @see startTyping in core/block-editor store.
  4182. */
  4183. const startTyping = getBlockEditorAction('startTyping');
  4184. /**
  4185. * @see stopTyping in core/block-editor store.
  4186. */
  4187. const stopTyping = getBlockEditorAction('stopTyping');
  4188. /**
  4189. * @see enterFormattedText in core/block-editor store.
  4190. */
  4191. const enterFormattedText = getBlockEditorAction('enterFormattedText');
  4192. /**
  4193. * @see exitFormattedText in core/block-editor store.
  4194. */
  4195. const exitFormattedText = getBlockEditorAction('exitFormattedText');
  4196. /**
  4197. * @see insertDefaultBlock in core/block-editor store.
  4198. */
  4199. const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock');
  4200. /**
  4201. * @see updateBlockListSettings in core/block-editor store.
  4202. */
  4203. const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings');
  4204. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js
  4205. /**
  4206. * WordPress dependencies
  4207. */
  4208. /**
  4209. * Internal dependencies
  4210. */
  4211. /**
  4212. * Post editor data store configuration.
  4213. *
  4214. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
  4215. *
  4216. * @type {Object}
  4217. */
  4218. const storeConfig = {
  4219. reducer: reducer,
  4220. selectors: selectors_namespaceObject,
  4221. actions: actions_namespaceObject
  4222. };
  4223. /**
  4224. * Store definition for the editor namespace.
  4225. *
  4226. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  4227. *
  4228. * @type {Object}
  4229. */
  4230. const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { ...storeConfig
  4231. });
  4232. (0,external_wp_data_namespaceObject.register)(store_store);
  4233. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js
  4234. /**
  4235. * External dependencies
  4236. */
  4237. /**
  4238. * WordPress dependencies
  4239. */
  4240. /**
  4241. * Internal dependencies
  4242. */
  4243. /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
  4244. /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
  4245. /**
  4246. * Object whose keys are the names of block attributes, where each value
  4247. * represents the meta key to which the block attribute is intended to save.
  4248. *
  4249. * @see https://developer.wordpress.org/reference/functions/register_meta/
  4250. *
  4251. * @typedef {Object<string,string>} WPMetaAttributeMapping
  4252. */
  4253. /**
  4254. * Given a mapping of attribute names (meta source attributes) to their
  4255. * associated meta key, returns a higher order component that overrides its
  4256. * `attributes` and `setAttributes` props to sync any changes with the edited
  4257. * post's meta keys.
  4258. *
  4259. * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.
  4260. *
  4261. * @return {WPHigherOrderComponent} Higher-order component.
  4262. */
  4263. const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => _ref => {
  4264. let {
  4265. attributes,
  4266. setAttributes,
  4267. ...props
  4268. } = _ref;
  4269. const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []);
  4270. const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta');
  4271. const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...attributes,
  4272. ...(0,external_lodash_namespaceObject.mapValues)(metaAttributes, metaKey => meta[metaKey])
  4273. }), [attributes, meta]);
  4274. return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({
  4275. attributes: mergedAttributes,
  4276. setAttributes: nextAttributes => {
  4277. const nextMeta = Object.fromEntries(Object.entries( // Filter to intersection of keys between the updated
  4278. // attributes and those with an associated meta key.
  4279. (0,external_lodash_namespaceObject.pickBy)(nextAttributes, (value, key) => metaAttributes[key])).map(_ref2 => {
  4280. let [attributeKey, value] = _ref2;
  4281. return [// Rename the keys to the expected meta key name.
  4282. metaAttributes[attributeKey], value];
  4283. }));
  4284. if (!(0,external_lodash_namespaceObject.isEmpty)(nextMeta)) {
  4285. setMeta(nextMeta);
  4286. }
  4287. setAttributes(nextAttributes);
  4288. }
  4289. }, props));
  4290. }, 'withMetaAttributeSource');
  4291. /**
  4292. * Filters a registered block's settings to enhance a block's `edit` component
  4293. * to upgrade meta-sourced attributes to use the post's meta entity property.
  4294. *
  4295. * @param {WPBlockSettings} settings Registered block settings.
  4296. *
  4297. * @return {WPBlockSettings} Filtered block settings.
  4298. */
  4299. function shimAttributeSource(settings) {
  4300. /** @type {WPMetaAttributeMapping} */
  4301. const metaAttributes = (0,external_lodash_namespaceObject.mapValues)((0,external_lodash_namespaceObject.pickBy)(settings.attributes, {
  4302. source: 'meta'
  4303. }), 'meta');
  4304. if (!(0,external_lodash_namespaceObject.isEmpty)(metaAttributes)) {
  4305. settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
  4306. }
  4307. return settings;
  4308. }
  4309. (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); // The above filter will only capture blocks registered after the filter was
  4310. // added. There may already be blocks registered by this point, and those must
  4311. // be updated to apply the shim.
  4312. //
  4313. // The following implementation achieves this, albeit with a couple caveats:
  4314. // - Only blocks registered on the global store will be modified.
  4315. // - The block settings are directly mutated, since there is currently no
  4316. // mechanism to update an existing block registration. This is the reason for
  4317. // `getBlockType` separate from `getBlockTypes`, since the latter returns a
  4318. // _copy_ of the block registration (i.e. the mutation would not affect the
  4319. // actual registered block settings).
  4320. //
  4321. // `getBlockTypes` or `getBlockType` implementation could change in the future
  4322. // in regards to creating settings clones, but the corresponding end-to-end
  4323. // tests for meta blocks should cover against any potential regressions.
  4324. //
  4325. // In the future, we could support updating block settings, at which point this
  4326. // implementation could use that mechanism instead.
  4327. (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getBlockTypes().map(_ref3 => {
  4328. let {
  4329. name
  4330. } = _ref3;
  4331. return (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getBlockType(name);
  4332. }).forEach(shimAttributeSource);
  4333. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js
  4334. /**
  4335. * WordPress dependencies
  4336. */
  4337. /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
  4338. function getUserLabel(user) {
  4339. const avatar = user.avatar_urls && user.avatar_urls[24] ? (0,external_wp_element_namespaceObject.createElement)("img", {
  4340. className: "editor-autocompleters__user-avatar",
  4341. alt: "",
  4342. src: user.avatar_urls[24]
  4343. }) : (0,external_wp_element_namespaceObject.createElement)("span", {
  4344. className: "editor-autocompleters__no-avatar"
  4345. });
  4346. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, avatar, (0,external_wp_element_namespaceObject.createElement)("span", {
  4347. className: "editor-autocompleters__user-name"
  4348. }, user.name), (0,external_wp_element_namespaceObject.createElement)("span", {
  4349. className: "editor-autocompleters__user-slug"
  4350. }, user.slug));
  4351. }
  4352. /**
  4353. * A user mentions completer.
  4354. *
  4355. * @type {WPCompleter}
  4356. */
  4357. /* harmony default export */ var user = ({
  4358. name: 'users',
  4359. className: 'editor-autocompleters__user',
  4360. triggerPrefix: '@',
  4361. useItems(filterValue) {
  4362. const users = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4363. const {
  4364. getUsers
  4365. } = select(external_wp_coreData_namespaceObject.store);
  4366. return getUsers({
  4367. context: 'view',
  4368. search: encodeURIComponent(filterValue)
  4369. });
  4370. }, [filterValue]);
  4371. const options = (0,external_wp_element_namespaceObject.useMemo)(() => users ? users.map(user => ({
  4372. key: `user-${user.slug}`,
  4373. value: user,
  4374. label: getUserLabel(user)
  4375. })) : [], [users]);
  4376. return [options];
  4377. },
  4378. getOptionCompletion(user) {
  4379. return `@${user.slug}`;
  4380. }
  4381. });
  4382. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js
  4383. /**
  4384. * External dependencies
  4385. */
  4386. /**
  4387. * WordPress dependencies
  4388. */
  4389. /**
  4390. * Internal dependencies
  4391. */
  4392. function setDefaultCompleters() {
  4393. let completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  4394. // Provide copies so filters may directly modify them.
  4395. completers.push((0,external_lodash_namespaceObject.clone)(user));
  4396. return completers;
  4397. }
  4398. (0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters);
  4399. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js
  4400. /**
  4401. * Internal dependencies
  4402. */
  4403. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js
  4404. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js
  4405. /**
  4406. * WordPress dependencies
  4407. */
  4408. /**
  4409. * Internal dependencies
  4410. */
  4411. /**
  4412. * AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected.
  4413. *
  4414. * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called.
  4415. * The time between the change and the autosave varies but is no larger than `props.interval` seconds. Refer to the code below for more details, such as
  4416. * the specific way of detecting changes.
  4417. *
  4418. * There are two caveats:
  4419. * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second.
  4420. * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`.
  4421. */
  4422. class AutosaveMonitor extends external_wp_element_namespaceObject.Component {
  4423. constructor(props) {
  4424. super(props);
  4425. this.needsAutosave = !!(props.isDirty && props.isAutosaveable);
  4426. }
  4427. componentDidMount() {
  4428. if (!this.props.disableIntervalChecks) {
  4429. this.setAutosaveTimer();
  4430. }
  4431. }
  4432. componentDidUpdate(prevProps) {
  4433. if (this.props.disableIntervalChecks) {
  4434. if (this.props.editsReference !== prevProps.editsReference) {
  4435. this.props.autosave();
  4436. }
  4437. return;
  4438. }
  4439. if (this.props.interval !== prevProps.interval) {
  4440. clearTimeout(this.timerId);
  4441. this.setAutosaveTimer();
  4442. }
  4443. if (!this.props.isDirty) {
  4444. this.needsAutosave = false;
  4445. return;
  4446. }
  4447. if (this.props.isAutosaving && !prevProps.isAutosaving) {
  4448. this.needsAutosave = false;
  4449. return;
  4450. }
  4451. if (this.props.editsReference !== prevProps.editsReference) {
  4452. this.needsAutosave = true;
  4453. }
  4454. }
  4455. componentWillUnmount() {
  4456. clearTimeout(this.timerId);
  4457. }
  4458. setAutosaveTimer() {
  4459. let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.interval * 1000;
  4460. this.timerId = setTimeout(() => {
  4461. this.autosaveTimerHandler();
  4462. }, timeout);
  4463. }
  4464. autosaveTimerHandler() {
  4465. if (!this.props.isAutosaveable) {
  4466. this.setAutosaveTimer(1000);
  4467. return;
  4468. }
  4469. if (this.needsAutosave) {
  4470. this.needsAutosave = false;
  4471. this.props.autosave();
  4472. }
  4473. this.setAutosaveTimer();
  4474. }
  4475. render() {
  4476. return null;
  4477. }
  4478. }
  4479. /* harmony default export */ var autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
  4480. const {
  4481. getReferenceByDistinctEdits
  4482. } = select(external_wp_coreData_namespaceObject.store);
  4483. const {
  4484. isEditedPostDirty,
  4485. isEditedPostAutosaveable,
  4486. isAutosavingPost,
  4487. getEditorSettings
  4488. } = select(store_store);
  4489. const {
  4490. interval = getEditorSettings().autosaveInterval
  4491. } = ownProps;
  4492. return {
  4493. editsReference: getReferenceByDistinctEdits(),
  4494. isDirty: isEditedPostDirty(),
  4495. isAutosaveable: isEditedPostAutosaveable(),
  4496. isAutosaving: isAutosavingPost(),
  4497. interval
  4498. };
  4499. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({
  4500. autosave() {
  4501. const {
  4502. autosave = dispatch(store_store).autosave
  4503. } = ownProps;
  4504. autosave();
  4505. }
  4506. }))])(AutosaveMonitor));
  4507. ;// CONCATENATED MODULE: external ["wp","richText"]
  4508. var external_wp_richText_namespaceObject = window["wp"]["richText"];
  4509. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  4510. var classnames = __webpack_require__(4403);
  4511. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  4512. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js
  4513. /**
  4514. * External dependencies
  4515. */
  4516. const TableOfContentsItem = _ref => {
  4517. let {
  4518. children,
  4519. isValid,
  4520. level,
  4521. href,
  4522. onSelect
  4523. } = _ref;
  4524. return (0,external_wp_element_namespaceObject.createElement)("li", {
  4525. className: classnames_default()('document-outline__item', `is-${level.toLowerCase()}`, {
  4526. 'is-invalid': !isValid
  4527. })
  4528. }, (0,external_wp_element_namespaceObject.createElement)("a", {
  4529. href: href,
  4530. className: "document-outline__button",
  4531. onClick: onSelect
  4532. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  4533. className: "document-outline__emdash",
  4534. "aria-hidden": "true"
  4535. }), (0,external_wp_element_namespaceObject.createElement)("strong", {
  4536. className: "document-outline__level"
  4537. }, level), (0,external_wp_element_namespaceObject.createElement)("span", {
  4538. className: "document-outline__item-content"
  4539. }, children)));
  4540. };
  4541. /* harmony default export */ var document_outline_item = (TableOfContentsItem);
  4542. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js
  4543. /**
  4544. * WordPress dependencies
  4545. */
  4546. /**
  4547. * Internal dependencies
  4548. */
  4549. /**
  4550. * Module constants
  4551. */
  4552. const emptyHeadingContent = (0,external_wp_element_namespaceObject.createElement)("em", null, (0,external_wp_i18n_namespaceObject.__)('(Empty heading)'));
  4553. const incorrectLevelContent = [(0,external_wp_element_namespaceObject.createElement)("br", {
  4554. key: "incorrect-break"
  4555. }), (0,external_wp_element_namespaceObject.createElement)("em", {
  4556. key: "incorrect-message"
  4557. }, (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)'))];
  4558. const singleH1Headings = [(0,external_wp_element_namespaceObject.createElement)("br", {
  4559. key: "incorrect-break-h1"
  4560. }), (0,external_wp_element_namespaceObject.createElement)("em", {
  4561. key: "incorrect-message-h1"
  4562. }, (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)'))];
  4563. const multipleH1Headings = [(0,external_wp_element_namespaceObject.createElement)("br", {
  4564. key: "incorrect-break-multiple-h1"
  4565. }), (0,external_wp_element_namespaceObject.createElement)("em", {
  4566. key: "incorrect-message-multiple-h1"
  4567. }, (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)'))];
  4568. /**
  4569. * Returns an array of heading blocks enhanced with the following properties:
  4570. * level - An integer with the heading level.
  4571. * isEmpty - Flag indicating if the heading has no content.
  4572. *
  4573. * @param {?Array} blocks An array of blocks.
  4574. *
  4575. * @return {Array} An array of heading blocks enhanced with the properties described above.
  4576. */
  4577. const computeOutlineHeadings = function () {
  4578. let blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  4579. return blocks.flatMap(function () {
  4580. let block = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  4581. if (block.name === 'core/heading') {
  4582. return { ...block,
  4583. level: block.attributes.level,
  4584. isEmpty: isEmptyHeading(block)
  4585. };
  4586. }
  4587. return computeOutlineHeadings(block.innerBlocks);
  4588. });
  4589. };
  4590. const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.length === 0;
  4591. const DocumentOutline = _ref => {
  4592. let {
  4593. blocks = [],
  4594. title,
  4595. onSelect,
  4596. isTitleSupported,
  4597. hasOutlineItemsDisabled
  4598. } = _ref;
  4599. const headings = computeOutlineHeadings(blocks);
  4600. if (headings.length < 1) {
  4601. return null;
  4602. }
  4603. let prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now.
  4604. const titleNode = document.querySelector('.editor-post-title__input');
  4605. const hasTitle = isTitleSupported && title && titleNode;
  4606. const countByLevel = headings.reduce((acc, heading) => ({ ...acc,
  4607. [heading.level]: (acc[heading.level] || 0) + 1
  4608. }), {});
  4609. const hasMultipleH1 = countByLevel[1] > 1;
  4610. return (0,external_wp_element_namespaceObject.createElement)("div", {
  4611. className: "document-outline"
  4612. }, (0,external_wp_element_namespaceObject.createElement)("ul", null, hasTitle && (0,external_wp_element_namespaceObject.createElement)(document_outline_item, {
  4613. level: (0,external_wp_i18n_namespaceObject.__)('Title'),
  4614. isValid: true,
  4615. onSelect: onSelect,
  4616. href: `#${titleNode.id}`,
  4617. isDisabled: hasOutlineItemsDisabled
  4618. }, title), headings.map((item, index) => {
  4619. // Headings remain the same, go up by one, or down by any amount.
  4620. // Otherwise there are missing levels.
  4621. const isIncorrectLevel = item.level > prevHeadingLevel + 1;
  4622. const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle);
  4623. prevHeadingLevel = item.level;
  4624. return (0,external_wp_element_namespaceObject.createElement)(document_outline_item, {
  4625. key: index,
  4626. level: `H${item.level}`,
  4627. isValid: isValid,
  4628. isDisabled: hasOutlineItemsDisabled,
  4629. href: `#block-${item.clientId}`,
  4630. onSelect: onSelect
  4631. }, item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({
  4632. html: item.attributes.content
  4633. })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings);
  4634. })));
  4635. };
  4636. /* harmony default export */ var document_outline = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => {
  4637. var _postType$supports$ti, _postType$supports;
  4638. const {
  4639. getBlocks
  4640. } = select(external_wp_blockEditor_namespaceObject.store);
  4641. const {
  4642. getEditedPostAttribute
  4643. } = select(store_store);
  4644. const {
  4645. getPostType
  4646. } = select(external_wp_coreData_namespaceObject.store);
  4647. const postType = getPostType(getEditedPostAttribute('type'));
  4648. return {
  4649. title: getEditedPostAttribute('title'),
  4650. blocks: getBlocks(),
  4651. isTitleSupported: (_postType$supports$ti = postType === null || postType === void 0 ? void 0 : (_postType$supports = postType.supports) === null || _postType$supports === void 0 ? void 0 : _postType$supports.title) !== null && _postType$supports$ti !== void 0 ? _postType$supports$ti : false
  4652. };
  4653. }))(DocumentOutline));
  4654. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js
  4655. /**
  4656. * External dependencies
  4657. */
  4658. /**
  4659. * WordPress dependencies
  4660. */
  4661. function DocumentOutlineCheck(_ref) {
  4662. let {
  4663. blocks,
  4664. children
  4665. } = _ref;
  4666. const headings = (0,external_lodash_namespaceObject.filter)(blocks, block => block.name === 'core/heading');
  4667. if (headings.length < 1) {
  4668. return null;
  4669. }
  4670. return children;
  4671. }
  4672. /* harmony default export */ var check = ((0,external_wp_data_namespaceObject.withSelect)(select => ({
  4673. blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks()
  4674. }))(DocumentOutlineCheck));
  4675. ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
  4676. var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
  4677. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js
  4678. /**
  4679. * WordPress dependencies
  4680. */
  4681. /**
  4682. * Internal dependencies
  4683. */
  4684. function SaveShortcut(_ref) {
  4685. let {
  4686. resetBlocksOnSave
  4687. } = _ref;
  4688. const {
  4689. resetEditorBlocks,
  4690. savePost
  4691. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4692. const {
  4693. isEditedPostDirty,
  4694. getPostEdits,
  4695. isPostSavingLocked
  4696. } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
  4697. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/save', event => {
  4698. event.preventDefault();
  4699. /**
  4700. * Do not save the post if post saving is locked.
  4701. */
  4702. if (isPostSavingLocked()) {
  4703. return;
  4704. } // TODO: This should be handled in the `savePost` effect in
  4705. // considering `isSaveable`. See note on `isEditedPostSaveable`
  4706. // selector about dirtiness and meta-boxes.
  4707. //
  4708. // See: `isEditedPostSaveable`
  4709. if (!isEditedPostDirty()) {
  4710. return;
  4711. } // The text editor requires that editor blocks are updated for a
  4712. // save to work correctly. Usually this happens when the textarea
  4713. // for the code editors blurs, but the shortcut can be used without
  4714. // blurring the textarea.
  4715. if (resetBlocksOnSave) {
  4716. const postEdits = getPostEdits();
  4717. if (postEdits.content && typeof postEdits.content === 'string') {
  4718. const blocks = (0,external_wp_blocks_namespaceObject.parse)(postEdits.content);
  4719. resetEditorBlocks(blocks);
  4720. }
  4721. }
  4722. savePost();
  4723. });
  4724. return null;
  4725. }
  4726. /* harmony default export */ var save_shortcut = (SaveShortcut);
  4727. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js
  4728. /**
  4729. * WordPress dependencies
  4730. */
  4731. /**
  4732. * Internal dependencies
  4733. */
  4734. function VisualEditorGlobalKeyboardShortcuts() {
  4735. const {
  4736. redo,
  4737. undo
  4738. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4739. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => {
  4740. undo();
  4741. event.preventDefault();
  4742. });
  4743. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/redo', event => {
  4744. redo();
  4745. event.preventDefault();
  4746. });
  4747. return (0,external_wp_element_namespaceObject.createElement)(save_shortcut, null);
  4748. }
  4749. /* harmony default export */ var visual_editor_shortcuts = (VisualEditorGlobalKeyboardShortcuts);
  4750. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js
  4751. /**
  4752. * Internal dependencies
  4753. */
  4754. function TextEditorGlobalKeyboardShortcuts() {
  4755. return (0,external_wp_element_namespaceObject.createElement)(save_shortcut, {
  4756. resetBlocksOnSave: true
  4757. });
  4758. }
  4759. ;// CONCATENATED MODULE: external ["wp","keycodes"]
  4760. var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
  4761. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js
  4762. /**
  4763. * WordPress dependencies
  4764. */
  4765. function EditorKeyboardShortcutsRegister() {
  4766. // Registering the shortcuts.
  4767. const {
  4768. registerShortcut
  4769. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
  4770. (0,external_wp_element_namespaceObject.useEffect)(() => {
  4771. registerShortcut({
  4772. name: 'core/editor/save',
  4773. category: 'global',
  4774. description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
  4775. keyCombination: {
  4776. modifier: 'primary',
  4777. character: 's'
  4778. }
  4779. });
  4780. registerShortcut({
  4781. name: 'core/editor/undo',
  4782. category: 'global',
  4783. description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'),
  4784. keyCombination: {
  4785. modifier: 'primary',
  4786. character: 'z'
  4787. }
  4788. });
  4789. registerShortcut({
  4790. name: 'core/editor/redo',
  4791. category: 'global',
  4792. description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'),
  4793. keyCombination: {
  4794. modifier: 'primaryShift',
  4795. character: 'z'
  4796. },
  4797. // Disable on Apple OS because it conflicts with the browser's
  4798. // history shortcut. It's a fine alias for both Windows and Linux.
  4799. // Since there's no conflict for Ctrl+Shift+Z on both Windows and
  4800. // Linux, we keep it as the default for consistency.
  4801. aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{
  4802. modifier: 'primary',
  4803. character: 'y'
  4804. }]
  4805. });
  4806. }, [registerShortcut]);
  4807. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null);
  4808. }
  4809. /* harmony default export */ var register_shortcuts = (EditorKeyboardShortcutsRegister);
  4810. ;// CONCATENATED MODULE: external ["wp","components"]
  4811. var external_wp_components_namespaceObject = window["wp"]["components"];
  4812. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
  4813. /**
  4814. * WordPress dependencies
  4815. */
  4816. const redo_redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4817. xmlns: "http://www.w3.org/2000/svg",
  4818. viewBox: "0 0 24 24"
  4819. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4820. d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
  4821. }));
  4822. /* harmony default export */ var library_redo = (redo_redo);
  4823. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
  4824. /**
  4825. * WordPress dependencies
  4826. */
  4827. const undo_undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4828. xmlns: "http://www.w3.org/2000/svg",
  4829. viewBox: "0 0 24 24"
  4830. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4831. d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
  4832. }));
  4833. /* harmony default export */ var library_undo = (undo_undo);
  4834. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js
  4835. /**
  4836. * WordPress dependencies
  4837. */
  4838. /**
  4839. * Internal dependencies
  4840. */
  4841. function EditorHistoryRedo(props, ref) {
  4842. const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y');
  4843. const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorRedo(), []);
  4844. const {
  4845. redo
  4846. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4847. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, {
  4848. ref: ref,
  4849. icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo
  4850. /* translators: button label text should, if possible, be under 16 characters. */
  4851. ,
  4852. label: (0,external_wp_i18n_namespaceObject.__)('Redo'),
  4853. shortcut: shortcut // If there are no redo levels we don't want to actually disable this
  4854. // button, because it will remove focus for keyboard users.
  4855. // See: https://github.com/WordPress/gutenberg/issues/3486
  4856. ,
  4857. "aria-disabled": !hasRedo,
  4858. onClick: hasRedo ? redo : undefined,
  4859. className: "editor-history__redo"
  4860. }));
  4861. }
  4862. /* harmony default export */ var editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo));
  4863. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js
  4864. /**
  4865. * WordPress dependencies
  4866. */
  4867. /**
  4868. * Internal dependencies
  4869. */
  4870. function EditorHistoryUndo(props, ref) {
  4871. const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorUndo(), []);
  4872. const {
  4873. undo
  4874. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4875. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, {
  4876. ref: ref,
  4877. icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo
  4878. /* translators: button label text should, if possible, be under 16 characters. */
  4879. ,
  4880. label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
  4881. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this
  4882. // button, because it will remove focus for keyboard users.
  4883. // See: https://github.com/WordPress/gutenberg/issues/3486
  4884. ,
  4885. "aria-disabled": !hasUndo,
  4886. onClick: hasUndo ? undo : undefined,
  4887. className: "editor-history__undo"
  4888. }));
  4889. }
  4890. /* harmony default export */ var editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo));
  4891. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js
  4892. /**
  4893. * WordPress dependencies
  4894. */
  4895. function TemplateValidationNotice(_ref) {
  4896. let {
  4897. isValid,
  4898. ...props
  4899. } = _ref;
  4900. if (isValid) {
  4901. return null;
  4902. }
  4903. const confirmSynchronization = () => {
  4904. if ( // eslint-disable-next-line no-alert
  4905. window.confirm((0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?'))) {
  4906. props.synchronizeTemplate();
  4907. }
  4908. };
  4909. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
  4910. className: "editor-template-validation-notice",
  4911. isDismissible: false,
  4912. status: "warning",
  4913. actions: [{
  4914. label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'),
  4915. onClick: props.resetTemplateValidity
  4916. }, {
  4917. label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'),
  4918. onClick: confirmSynchronization
  4919. }]
  4920. }, (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.'));
  4921. }
  4922. /* harmony default export */ var template_validation_notice = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
  4923. isValid: select(external_wp_blockEditor_namespaceObject.store).isValidTemplate()
  4924. })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  4925. const {
  4926. setTemplateValidity,
  4927. synchronizeTemplate
  4928. } = dispatch(external_wp_blockEditor_namespaceObject.store);
  4929. return {
  4930. resetTemplateValidity: () => setTemplateValidity(true),
  4931. synchronizeTemplate
  4932. };
  4933. })])(TemplateValidationNotice));
  4934. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js
  4935. /**
  4936. * External dependencies
  4937. */
  4938. /**
  4939. * WordPress dependencies
  4940. */
  4941. /**
  4942. * Internal dependencies
  4943. */
  4944. function EditorNotices(_ref) {
  4945. let {
  4946. notices,
  4947. onRemove
  4948. } = _ref;
  4949. const dismissibleNotices = (0,external_lodash_namespaceObject.filter)(notices, {
  4950. isDismissible: true,
  4951. type: 'default'
  4952. });
  4953. const nonDismissibleNotices = (0,external_lodash_namespaceObject.filter)(notices, {
  4954. isDismissible: false,
  4955. type: 'default'
  4956. });
  4957. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, {
  4958. notices: nonDismissibleNotices,
  4959. className: "components-editor-notices__pinned"
  4960. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, {
  4961. notices: dismissibleNotices,
  4962. className: "components-editor-notices__dismissible",
  4963. onRemove: onRemove
  4964. }, (0,external_wp_element_namespaceObject.createElement)(template_validation_notice, null)));
  4965. }
  4966. /* harmony default export */ var editor_notices = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
  4967. notices: select(external_wp_notices_namespaceObject.store).getNotices()
  4968. })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  4969. onRemove: dispatch(external_wp_notices_namespaceObject.store).removeNotice
  4970. }))])(EditorNotices));
  4971. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js
  4972. /**
  4973. * External dependencies
  4974. */
  4975. /**
  4976. * WordPress dependencies
  4977. */
  4978. function EditorSnackbars() {
  4979. const notices = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_notices_namespaceObject.store).getNotices(), []);
  4980. const {
  4981. removeNotice
  4982. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  4983. const snackbarNotices = (0,external_lodash_namespaceObject.filter)(notices, {
  4984. type: 'snackbar'
  4985. });
  4986. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SnackbarList, {
  4987. notices: snackbarNotices,
  4988. className: "components-editor-notices__snackbar",
  4989. onRemove: removeNotice
  4990. });
  4991. }
  4992. ;// CONCATENATED MODULE: external ["wp","htmlEntities"]
  4993. var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
  4994. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js
  4995. /**
  4996. * WordPress dependencies
  4997. */
  4998. /**
  4999. * Internal dependencies
  5000. */
  5001. function EntityRecordItem(_ref) {
  5002. let {
  5003. record,
  5004. checked,
  5005. onChange,
  5006. closePanel
  5007. } = _ref;
  5008. const {
  5009. name,
  5010. kind,
  5011. title,
  5012. key
  5013. } = record;
  5014. const parentBlockId = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5015. var _blocks$;
  5016. // Get entity's blocks.
  5017. const {
  5018. blocks = []
  5019. } = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key); // Get parents of the entity's first block.
  5020. const parents = select(external_wp_blockEditor_namespaceObject.store).getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId.
  5021. return parents[parents.length - 1];
  5022. }, []); // Handle templates that might use default descriptive titles.
  5023. const entityRecordTitle = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5024. if ('postType' !== kind || 'wp_template' !== name) {
  5025. return title;
  5026. }
  5027. const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key);
  5028. return select(store_store).__experimentalGetTemplateInfo(template).title;
  5029. }, [name, kind, title, key]);
  5030. const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5031. const selectedBlockId = select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientId();
  5032. return selectedBlockId === parentBlockId;
  5033. }, [parentBlockId]);
  5034. const isSelectedText = isSelected ? (0,external_wp_i18n_namespaceObject.__)('Selected') : (0,external_wp_i18n_namespaceObject.__)('Select');
  5035. const {
  5036. selectBlock
  5037. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  5038. const selectParentBlock = (0,external_wp_element_namespaceObject.useCallback)(() => selectBlock(parentBlockId), [parentBlockId]);
  5039. const selectAndDismiss = (0,external_wp_element_namespaceObject.useCallback)(() => {
  5040. selectBlock(parentBlockId);
  5041. closePanel();
  5042. }, [parentBlockId]);
  5043. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  5044. label: (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled')),
  5045. checked: checked,
  5046. onChange: onChange
  5047. }), parentBlockId ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5048. onClick: selectParentBlock,
  5049. className: "entities-saved-states__find-entity",
  5050. disabled: isSelected
  5051. }, isSelectedText), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5052. onClick: selectAndDismiss,
  5053. className: "entities-saved-states__find-entity-small",
  5054. disabled: isSelected
  5055. }, isSelectedText)) : null);
  5056. }
  5057. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js
  5058. /**
  5059. * External dependencies
  5060. */
  5061. /**
  5062. * WordPress dependencies
  5063. */
  5064. /**
  5065. * Internal dependencies
  5066. */
  5067. function getEntityDescription(entity, count) {
  5068. switch (entity) {
  5069. case 'site':
  5070. return 1 === count ? (0,external_wp_i18n_namespaceObject.__)('This change will affect your whole site.') : (0,external_wp_i18n_namespaceObject.__)('These changes will affect your whole site.');
  5071. case 'wp_template':
  5072. return (0,external_wp_i18n_namespaceObject.__)('This change will affect pages and posts that use this template.');
  5073. case 'page':
  5074. case 'post':
  5075. return (0,external_wp_i18n_namespaceObject.__)('The following content has been modified.');
  5076. }
  5077. }
  5078. function EntityTypeList(_ref) {
  5079. let {
  5080. list,
  5081. unselectedEntities,
  5082. setUnselectedEntities,
  5083. closePanel
  5084. } = _ref;
  5085. const count = list.length;
  5086. const firstRecord = list[0];
  5087. const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]);
  5088. const {
  5089. name
  5090. } = firstRecord;
  5091. let entityLabel = entityConfig.label;
  5092. if (name === 'wp_template_part') {
  5093. entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)('Template Part') : (0,external_wp_i18n_namespaceObject.__)('Template Parts');
  5094. } // Set description based on type of entity.
  5095. const description = getEntityDescription(name, count);
  5096. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  5097. title: entityLabel,
  5098. initialOpen: true
  5099. }, description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, description), list.map(record => {
  5100. return (0,external_wp_element_namespaceObject.createElement)(EntityRecordItem, {
  5101. key: record.key || record.property,
  5102. record: record,
  5103. checked: !(0,external_lodash_namespaceObject.some)(unselectedEntities, elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property),
  5104. onChange: value => setUnselectedEntities(record, value),
  5105. closePanel: closePanel
  5106. });
  5107. }));
  5108. }
  5109. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js
  5110. /**
  5111. * External dependencies
  5112. */
  5113. /**
  5114. * WordPress dependencies
  5115. */
  5116. /**
  5117. * Internal dependencies
  5118. */
  5119. const TRANSLATED_SITE_PROPERTIES = {
  5120. title: (0,external_wp_i18n_namespaceObject.__)('Title'),
  5121. description: (0,external_wp_i18n_namespaceObject.__)('Tagline'),
  5122. site_logo: (0,external_wp_i18n_namespaceObject.__)('Logo'),
  5123. site_icon: (0,external_wp_i18n_namespaceObject.__)('Icon'),
  5124. show_on_front: (0,external_wp_i18n_namespaceObject.__)('Show on front'),
  5125. page_on_front: (0,external_wp_i18n_namespaceObject.__)('Page on front')
  5126. };
  5127. const PUBLISH_ON_SAVE_ENTITIES = [{
  5128. kind: 'postType',
  5129. name: 'wp_navigation'
  5130. }];
  5131. function EntitiesSavedStates(_ref) {
  5132. let {
  5133. close
  5134. } = _ref;
  5135. const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)();
  5136. const {
  5137. dirtyEntityRecords
  5138. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5139. const dirtyRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces.
  5140. const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site'));
  5141. const siteEdits = select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('root', 'site');
  5142. const siteEditsAsEntities = [];
  5143. for (const property in siteEdits) {
  5144. siteEditsAsEntities.push({
  5145. kind: 'root',
  5146. name: 'site',
  5147. title: TRANSLATED_SITE_PROPERTIES[property] || property,
  5148. property
  5149. });
  5150. }
  5151. const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities];
  5152. return {
  5153. dirtyEntityRecords: dirtyRecordsWithSiteItems
  5154. };
  5155. }, []);
  5156. const {
  5157. editEntityRecord,
  5158. saveEditedEntityRecord,
  5159. __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
  5160. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  5161. const {
  5162. __unstableMarkLastChangeAsPersistent
  5163. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  5164. const {
  5165. createSuccessNotice,
  5166. createErrorNotice
  5167. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); // To group entities by type.
  5168. const partitionedSavables = (0,external_lodash_namespaceObject.groupBy)(dirtyEntityRecords, 'name'); // Sort entity groups.
  5169. const {
  5170. site: siteSavables,
  5171. wp_template: templateSavables,
  5172. wp_template_part: templatePartSavables,
  5173. ...contentSavables
  5174. } = partitionedSavables;
  5175. const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray); // Unchecked entities to be ignored by save function.
  5176. const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]);
  5177. const setUnselectedEntities = (_ref2, checked) => {
  5178. let {
  5179. kind,
  5180. name,
  5181. key,
  5182. property
  5183. } = _ref2;
  5184. if (checked) {
  5185. _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
  5186. } else {
  5187. _setUnselectedEntities([...unselectedEntities, {
  5188. kind,
  5189. name,
  5190. key,
  5191. property
  5192. }]);
  5193. }
  5194. };
  5195. const saveCheckedEntities = () => {
  5196. const entitiesToSave = dirtyEntityRecords.filter(_ref3 => {
  5197. let {
  5198. kind,
  5199. name,
  5200. key,
  5201. property
  5202. } = _ref3;
  5203. return !(0,external_lodash_namespaceObject.some)(unselectedEntities, elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
  5204. });
  5205. close(entitiesToSave);
  5206. const siteItemsToSave = [];
  5207. const pendingSavedRecords = [];
  5208. entitiesToSave.forEach(_ref4 => {
  5209. let {
  5210. kind,
  5211. name,
  5212. key,
  5213. property
  5214. } = _ref4;
  5215. if ('root' === kind && 'site' === name) {
  5216. siteItemsToSave.push(property);
  5217. } else {
  5218. if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) {
  5219. editEntityRecord(kind, name, key, {
  5220. status: 'publish'
  5221. });
  5222. }
  5223. pendingSavedRecords.push(saveEditedEntityRecord(kind, name, key));
  5224. }
  5225. });
  5226. if (siteItemsToSave.length) {
  5227. pendingSavedRecords.push(saveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave));
  5228. }
  5229. __unstableMarkLastChangeAsPersistent();
  5230. Promise.all(pendingSavedRecords).then(values => {
  5231. if (values.some(value => typeof value === 'undefined')) {
  5232. createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.'));
  5233. } else {
  5234. createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), {
  5235. type: 'snackbar'
  5236. });
  5237. }
  5238. }).catch(error => createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} ${error}`));
  5239. }; // Explicitly define this with no argument passed. Using `close` on
  5240. // its own will use the event object in place of the expected saved entities.
  5241. const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]);
  5242. const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
  5243. onClose: () => dismissPanel()
  5244. });
  5245. return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
  5246. ref: saveDialogRef
  5247. }, saveDialogProps, {
  5248. className: "entities-saved-states__panel"
  5249. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  5250. className: "entities-saved-states__panel-header",
  5251. gap: 2
  5252. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
  5253. isBlock: true,
  5254. as: external_wp_components_namespaceObject.Button,
  5255. ref: saveButtonRef,
  5256. variant: "primary",
  5257. disabled: dirtyEntityRecords.length - unselectedEntities.length === 0,
  5258. onClick: saveCheckedEntities,
  5259. className: "editor-entities-saved-states__save-button"
  5260. }, (0,external_wp_i18n_namespaceObject.__)('Save')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
  5261. isBlock: true,
  5262. as: external_wp_components_namespaceObject.Button,
  5263. variant: "secondary",
  5264. onClick: dismissPanel
  5265. }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)("div", {
  5266. className: "entities-saved-states__text-prompt"
  5267. }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('The following changes have been made to your site, templates, and content.'))), sortedPartitionedSavables.map(list => {
  5268. return (0,external_wp_element_namespaceObject.createElement)(EntityTypeList, {
  5269. key: list[0].name,
  5270. list: list,
  5271. closePanel: dismissPanel,
  5272. unselectedEntities: unselectedEntities,
  5273. setUnselectedEntities: setUnselectedEntities
  5274. });
  5275. }));
  5276. }
  5277. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js
  5278. /**
  5279. * WordPress dependencies
  5280. */
  5281. /**
  5282. * Internal dependencies
  5283. */
  5284. function CopyButton(_ref) {
  5285. let {
  5286. text,
  5287. children
  5288. } = _ref;
  5289. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
  5290. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5291. variant: "secondary",
  5292. ref: ref
  5293. }, children);
  5294. }
  5295. class ErrorBoundary extends external_wp_element_namespaceObject.Component {
  5296. constructor() {
  5297. super(...arguments);
  5298. this.reboot = this.reboot.bind(this);
  5299. this.getContent = this.getContent.bind(this);
  5300. this.state = {
  5301. error: null
  5302. };
  5303. }
  5304. componentDidCatch(error) {
  5305. this.setState({
  5306. error
  5307. });
  5308. (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error);
  5309. }
  5310. reboot() {
  5311. this.props.onError();
  5312. }
  5313. getContent() {
  5314. try {
  5315. // While `select` in a component is generally discouraged, it is
  5316. // used here because it (a) reduces the chance of data loss in the
  5317. // case of additional errors by performing a direct retrieval and
  5318. // (b) avoids the performance cost associated with unnecessary
  5319. // content serialization throughout the lifetime of a non-erroring
  5320. // application.
  5321. return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent();
  5322. } catch (error) {}
  5323. }
  5324. render() {
  5325. const {
  5326. error
  5327. } = this.state;
  5328. if (!error) {
  5329. return this.props.children;
  5330. }
  5331. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
  5332. className: "editor-error-boundary",
  5333. actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5334. key: "recovery",
  5335. onClick: this.reboot,
  5336. variant: "secondary"
  5337. }, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, {
  5338. key: "copy-post",
  5339. text: this.getContent
  5340. }, (0,external_wp_i18n_namespaceObject.__)('Copy Post Text')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, {
  5341. key: "copy-error",
  5342. text: error.stack
  5343. }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))]
  5344. }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'));
  5345. }
  5346. }
  5347. /* harmony default export */ var error_boundary = (ErrorBoundary);
  5348. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js
  5349. /**
  5350. * WordPress dependencies
  5351. */
  5352. /**
  5353. * Internal dependencies
  5354. */
  5355. const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
  5356. let hasStorageSupport;
  5357. let uniqueId = 0;
  5358. /**
  5359. * Function which returns true if the current environment supports browser
  5360. * sessionStorage, or false otherwise. The result of this function is cached and
  5361. * reused in subsequent invocations.
  5362. */
  5363. const hasSessionStorageSupport = () => {
  5364. if (typeof hasStorageSupport === 'undefined') {
  5365. try {
  5366. // Private Browsing in Safari 10 and earlier will throw an error when
  5367. // attempting to set into sessionStorage. The test here is intentional in
  5368. // causing a thrown error as condition bailing from local autosave.
  5369. window.sessionStorage.setItem('__wpEditorTestSessionStorage', '');
  5370. window.sessionStorage.removeItem('__wpEditorTestSessionStorage');
  5371. hasStorageSupport = true;
  5372. } catch (error) {
  5373. hasStorageSupport = false;
  5374. }
  5375. }
  5376. return hasStorageSupport;
  5377. };
  5378. /**
  5379. * Custom hook which manages the creation of a notice prompting the user to
  5380. * restore a local autosave, if one exists.
  5381. */
  5382. function useAutosaveNotice() {
  5383. const {
  5384. postId,
  5385. isEditedPostNew,
  5386. hasRemoteAutosave
  5387. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  5388. postId: select(store_store).getCurrentPostId(),
  5389. isEditedPostNew: select(store_store).isEditedPostNew(),
  5390. hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave
  5391. }), []);
  5392. const {
  5393. getEditedPostAttribute
  5394. } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
  5395. const {
  5396. createWarningNotice,
  5397. removeNotice
  5398. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  5399. const {
  5400. editPost,
  5401. resetEditorBlocks
  5402. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5403. (0,external_wp_element_namespaceObject.useEffect)(() => {
  5404. let localAutosave = localAutosaveGet(postId, isEditedPostNew);
  5405. if (!localAutosave) {
  5406. return;
  5407. }
  5408. try {
  5409. localAutosave = JSON.parse(localAutosave);
  5410. } catch (error) {
  5411. // Not usable if it can't be parsed.
  5412. return;
  5413. }
  5414. const {
  5415. post_title: title,
  5416. content,
  5417. excerpt
  5418. } = localAutosave;
  5419. const edits = {
  5420. title,
  5421. content,
  5422. excerpt
  5423. };
  5424. {
  5425. // Only display a notice if there is a difference between what has been
  5426. // saved and that which is stored in sessionStorage.
  5427. const hasDifference = Object.keys(edits).some(key => {
  5428. return edits[key] !== getEditedPostAttribute(key);
  5429. });
  5430. if (!hasDifference) {
  5431. // If there is no difference, it can be safely ejected from storage.
  5432. localAutosaveClear(postId, isEditedPostNew);
  5433. return;
  5434. }
  5435. }
  5436. if (hasRemoteAutosave) {
  5437. return;
  5438. }
  5439. const noticeId = `wpEditorAutosaveRestore${++uniqueId}`;
  5440. createWarningNotice((0,external_wp_i18n_namespaceObject.__)('The backup of this post in your browser is different from the version below.'), {
  5441. id: noticeId,
  5442. actions: [{
  5443. label: (0,external_wp_i18n_namespaceObject.__)('Restore the backup'),
  5444. onClick() {
  5445. const {
  5446. content: editsContent,
  5447. ...editsWithoutContent
  5448. } = edits;
  5449. editPost(editsWithoutContent);
  5450. resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content));
  5451. removeNotice(noticeId);
  5452. }
  5453. }]
  5454. });
  5455. }, [isEditedPostNew, postId]);
  5456. }
  5457. /**
  5458. * Custom hook which ejects a local autosave after a successful save occurs.
  5459. */
  5460. function useAutosavePurge() {
  5461. const {
  5462. postId,
  5463. isEditedPostNew,
  5464. isDirty,
  5465. isAutosaving,
  5466. didError
  5467. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  5468. postId: select(store_store).getCurrentPostId(),
  5469. isEditedPostNew: select(store_store).isEditedPostNew(),
  5470. isDirty: select(store_store).isEditedPostDirty(),
  5471. isAutosaving: select(store_store).isAutosavingPost(),
  5472. didError: select(store_store).didPostSaveRequestFail()
  5473. }), []);
  5474. const lastIsDirty = (0,external_wp_element_namespaceObject.useRef)(isDirty);
  5475. const lastIsAutosaving = (0,external_wp_element_namespaceObject.useRef)(isAutosaving);
  5476. (0,external_wp_element_namespaceObject.useEffect)(() => {
  5477. if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) {
  5478. localAutosaveClear(postId, isEditedPostNew);
  5479. }
  5480. lastIsDirty.current = isDirty;
  5481. lastIsAutosaving.current = isAutosaving;
  5482. }, [isDirty, isAutosaving, didError]); // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.
  5483. const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew);
  5484. const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId);
  5485. (0,external_wp_element_namespaceObject.useEffect)(() => {
  5486. if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) {
  5487. localAutosaveClear(postId, true);
  5488. }
  5489. }, [isEditedPostNew, postId]);
  5490. }
  5491. function LocalAutosaveMonitor() {
  5492. const {
  5493. autosave
  5494. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5495. const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => {
  5496. requestIdleCallback(() => autosave({
  5497. local: true
  5498. }));
  5499. }, []);
  5500. useAutosaveNotice();
  5501. useAutosavePurge();
  5502. const {
  5503. localAutosaveInterval
  5504. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  5505. localAutosaveInterval: select(store_store).getEditorSettings().localAutosaveInterval
  5506. }), []);
  5507. return (0,external_wp_element_namespaceObject.createElement)(autosave_monitor, {
  5508. interval: localAutosaveInterval,
  5509. autosave: deferredAutosave
  5510. });
  5511. }
  5512. /* harmony default export */ var local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor));
  5513. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js
  5514. /**
  5515. * External dependencies
  5516. */
  5517. /**
  5518. * WordPress dependencies
  5519. */
  5520. /**
  5521. * Internal dependencies
  5522. */
  5523. function PageAttributesCheck(_ref) {
  5524. let {
  5525. children
  5526. } = _ref;
  5527. const postType = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5528. const {
  5529. getEditedPostAttribute
  5530. } = select(store_store);
  5531. const {
  5532. getPostType
  5533. } = select(external_wp_coreData_namespaceObject.store);
  5534. return getPostType(getEditedPostAttribute('type'));
  5535. }, []);
  5536. const supportsPageAttributes = (0,external_lodash_namespaceObject.get)(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist.
  5537. if (!supportsPageAttributes) {
  5538. return null;
  5539. }
  5540. return children;
  5541. }
  5542. /* harmony default export */ var page_attributes_check = (PageAttributesCheck);
  5543. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js
  5544. /**
  5545. * External dependencies
  5546. */
  5547. /**
  5548. * WordPress dependencies
  5549. */
  5550. /**
  5551. * Internal dependencies
  5552. */
  5553. /**
  5554. * A component which renders its own children only if the current editor post
  5555. * type supports one of the given `supportKeys` prop.
  5556. *
  5557. * @param {Object} props Props.
  5558. * @param {string} [props.postType] Current post type.
  5559. * @param {WPElement} props.children Children to be rendered if post
  5560. * type supports.
  5561. * @param {(string|string[])} props.supportKeys String or string array of keys
  5562. * to test.
  5563. *
  5564. * @return {WPComponent} The component to be rendered.
  5565. */
  5566. function PostTypeSupportCheck(_ref) {
  5567. let {
  5568. postType,
  5569. children,
  5570. supportKeys
  5571. } = _ref;
  5572. let isSupported = true;
  5573. if (postType) {
  5574. isSupported = (0,external_lodash_namespaceObject.some)((0,external_lodash_namespaceObject.castArray)(supportKeys), key => !!postType.supports[key]);
  5575. }
  5576. if (!isSupported) {
  5577. return null;
  5578. }
  5579. return children;
  5580. }
  5581. /* harmony default export */ var post_type_support_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  5582. const {
  5583. getEditedPostAttribute
  5584. } = select(store_store);
  5585. const {
  5586. getPostType
  5587. } = select(external_wp_coreData_namespaceObject.store);
  5588. return {
  5589. postType: getPostType(getEditedPostAttribute('type'))
  5590. };
  5591. })(PostTypeSupportCheck));
  5592. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js
  5593. /**
  5594. * WordPress dependencies
  5595. */
  5596. /**
  5597. * Internal dependencies
  5598. */
  5599. const PageAttributesOrder = _ref => {
  5600. let {
  5601. onUpdateOrder,
  5602. order = 0
  5603. } = _ref;
  5604. const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null);
  5605. const setUpdatedOrder = value => {
  5606. var _value$trim;
  5607. setOrderInput(value);
  5608. const newOrder = Number(value);
  5609. if (Number.isInteger(newOrder) && ((_value$trim = value.trim) === null || _value$trim === void 0 ? void 0 : _value$trim.call(value)) !== '') {
  5610. onUpdateOrder(Number(value));
  5611. }
  5612. };
  5613. const value = orderInput === null ? order : orderInput;
  5614. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  5615. className: "editor-page-attributes__order",
  5616. type: "number",
  5617. label: (0,external_wp_i18n_namespaceObject.__)('Order'),
  5618. value: value,
  5619. onChange: setUpdatedOrder,
  5620. size: 6,
  5621. onBlur: () => {
  5622. setOrderInput(null);
  5623. }
  5624. });
  5625. };
  5626. function PageAttributesOrderWithChecks(props) {
  5627. return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
  5628. supportKeys: "page-attributes"
  5629. }, (0,external_wp_element_namespaceObject.createElement)(PageAttributesOrder, props));
  5630. }
  5631. /* harmony default export */ var order = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  5632. return {
  5633. order: select(store_store).getEditedPostAttribute('menu_order')
  5634. };
  5635. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  5636. onUpdateOrder(order) {
  5637. dispatch(store_store).editPost({
  5638. menu_order: order
  5639. });
  5640. }
  5641. }))])(PageAttributesOrderWithChecks));
  5642. // EXTERNAL MODULE: ./node_modules/remove-accents/index.js
  5643. var remove_accents = __webpack_require__(4793);
  5644. var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
  5645. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js
  5646. /**
  5647. * External dependencies
  5648. */
  5649. /**
  5650. * Returns terms in a tree form.
  5651. *
  5652. * @param {Array} flatTerms Array of terms in flat format.
  5653. *
  5654. * @return {Array} Array of terms in tree format.
  5655. */
  5656. function buildTermsTree(flatTerms) {
  5657. const flatTermsWithParentAndChildren = flatTerms.map(term => {
  5658. return {
  5659. children: [],
  5660. parent: null,
  5661. ...term
  5662. };
  5663. });
  5664. const termsByParent = (0,external_lodash_namespaceObject.groupBy)(flatTermsWithParentAndChildren, 'parent');
  5665. if (termsByParent.null && termsByParent.null.length) {
  5666. return flatTermsWithParentAndChildren;
  5667. }
  5668. const fillWithChildren = terms => {
  5669. return terms.map(term => {
  5670. const children = termsByParent[term.id];
  5671. return { ...term,
  5672. children: children && children.length ? fillWithChildren(children) : []
  5673. };
  5674. });
  5675. };
  5676. return fillWithChildren(termsByParent['0'] || []);
  5677. } // Lodash unescape function handles &#39; but not &#039; which may be return in some API requests.
  5678. const unescapeString = arg => {
  5679. return (0,external_lodash_namespaceObject.unescape)(arg.replace('&#039;', "'"));
  5680. };
  5681. /**
  5682. * Returns a term object with name unescaped.
  5683. * The unescape of the name property is done using lodash unescape function.
  5684. *
  5685. * @param {Object} term The term object to unescape.
  5686. *
  5687. * @return {Object} Term object with name property unescaped.
  5688. */
  5689. const unescapeTerm = term => {
  5690. return { ...term,
  5691. name: unescapeString(term.name)
  5692. };
  5693. };
  5694. /**
  5695. * Returns an array of term objects with names unescaped.
  5696. * The unescape of each term is performed using the unescapeTerm function.
  5697. *
  5698. * @param {Object[]} terms Array of term objects to unescape.
  5699. *
  5700. * @return {Object[]} Array of term objects unescaped.
  5701. */
  5702. const unescapeTerms = terms => {
  5703. return (0,external_lodash_namespaceObject.map)(terms, unescapeTerm);
  5704. };
  5705. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js
  5706. /**
  5707. * External dependencies
  5708. */
  5709. /**
  5710. * WordPress dependencies
  5711. */
  5712. /**
  5713. * Internal dependencies
  5714. */
  5715. function getTitle(post) {
  5716. var _post$title;
  5717. return post !== null && post !== void 0 && (_post$title = post.title) !== null && _post$title !== void 0 && _post$title.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`;
  5718. }
  5719. const getItemPriority = (name, searchValue) => {
  5720. const normalizedName = remove_accents_default()(name || '').toLowerCase();
  5721. const normalizedSearch = remove_accents_default()(searchValue || '').toLowerCase();
  5722. if (normalizedName === normalizedSearch) {
  5723. return 0;
  5724. }
  5725. if (normalizedName.startsWith(normalizedSearch)) {
  5726. return normalizedName.length;
  5727. }
  5728. return Infinity;
  5729. };
  5730. function PageAttributesParent() {
  5731. const {
  5732. editPost
  5733. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5734. const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false);
  5735. const {
  5736. parentPost,
  5737. parentPostId,
  5738. items,
  5739. postType
  5740. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5741. const {
  5742. getPostType,
  5743. getEntityRecords,
  5744. getEntityRecord
  5745. } = select(external_wp_coreData_namespaceObject.store);
  5746. const {
  5747. getCurrentPostId,
  5748. getEditedPostAttribute
  5749. } = select(store_store);
  5750. const postTypeSlug = getEditedPostAttribute('type');
  5751. const pageId = getEditedPostAttribute('parent');
  5752. const pType = getPostType(postTypeSlug);
  5753. const postId = getCurrentPostId();
  5754. const isHierarchical = (0,external_lodash_namespaceObject.get)(pType, ['hierarchical'], false);
  5755. const query = {
  5756. per_page: 100,
  5757. exclude: postId,
  5758. parent_exclude: postId,
  5759. orderby: 'menu_order',
  5760. order: 'asc',
  5761. _fields: 'id,title,parent'
  5762. }; // Perform a search when the field is changed.
  5763. if (!!fieldValue) {
  5764. query.search = fieldValue;
  5765. }
  5766. return {
  5767. parentPostId: pageId,
  5768. parentPost: pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null,
  5769. items: isHierarchical ? getEntityRecords('postType', postTypeSlug, query) : [],
  5770. postType: pType
  5771. };
  5772. }, [fieldValue]);
  5773. const isHierarchical = (0,external_lodash_namespaceObject.get)(postType, ['hierarchical'], false);
  5774. const parentPageLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'parent_item_colon']);
  5775. const pageItems = items || [];
  5776. const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
  5777. const getOptionsFromTree = function (tree) {
  5778. let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  5779. const mappedNodes = tree.map(treeNode => [{
  5780. value: treeNode.id,
  5781. label: '— '.repeat(level) + (0,external_lodash_namespaceObject.unescape)(treeNode.name),
  5782. rawName: treeNode.name
  5783. }, ...getOptionsFromTree(treeNode.children || [], level + 1)]);
  5784. const sortedNodes = mappedNodes.sort((_ref, _ref2) => {
  5785. let [a] = _ref;
  5786. let [b] = _ref2;
  5787. const priorityA = getItemPriority(a.rawName, fieldValue);
  5788. const priorityB = getItemPriority(b.rawName, fieldValue);
  5789. return priorityA >= priorityB ? 1 : -1;
  5790. });
  5791. return sortedNodes.flat();
  5792. };
  5793. let tree = pageItems.map(item => ({
  5794. id: item.id,
  5795. parent: item.parent,
  5796. name: getTitle(item)
  5797. })); // Only build a hierarchical tree when not searching.
  5798. if (!fieldValue) {
  5799. tree = buildTermsTree(tree);
  5800. }
  5801. const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list.
  5802. const optsHasParent = (0,external_lodash_namespaceObject.find)(opts, item => item.value === parentPostId);
  5803. if (parentPost && !optsHasParent) {
  5804. opts.unshift({
  5805. value: parentPostId,
  5806. label: getTitle(parentPost)
  5807. });
  5808. }
  5809. return opts;
  5810. }, [pageItems, fieldValue]);
  5811. if (!isHierarchical || !parentPageLabel) {
  5812. return null;
  5813. }
  5814. /**
  5815. * Handle user input.
  5816. *
  5817. * @param {string} inputValue The current value of the input field.
  5818. */
  5819. const handleKeydown = inputValue => {
  5820. setFieldValue(inputValue);
  5821. };
  5822. /**
  5823. * Handle author selection.
  5824. *
  5825. * @param {Object} selectedPostId The selected Author.
  5826. */
  5827. const handleChange = selectedPostId => {
  5828. editPost({
  5829. parent: selectedPostId
  5830. });
  5831. };
  5832. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
  5833. className: "editor-page-attributes__parent",
  5834. label: parentPageLabel,
  5835. value: parentPostId,
  5836. options: parentOptions,
  5837. onFilterValueChange: (0,external_lodash_namespaceObject.debounce)(handleKeydown, 300),
  5838. onChange: handleChange
  5839. });
  5840. }
  5841. /* harmony default export */ var page_attributes_parent = (PageAttributesParent);
  5842. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/index.js
  5843. /**
  5844. * External dependencies
  5845. */
  5846. /**
  5847. * WordPress dependencies
  5848. */
  5849. /**
  5850. * Internal dependencies
  5851. */
  5852. function PostTemplate() {
  5853. const {
  5854. availableTemplates,
  5855. selectedTemplate,
  5856. isViewable
  5857. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5858. var _getPostType$viewable, _getPostType;
  5859. const {
  5860. getEditedPostAttribute,
  5861. getEditorSettings,
  5862. getCurrentPostType
  5863. } = select(store_store);
  5864. const {
  5865. getPostType
  5866. } = select(external_wp_coreData_namespaceObject.store);
  5867. return {
  5868. selectedTemplate: getEditedPostAttribute('template'),
  5869. availableTemplates: getEditorSettings().availableTemplates,
  5870. isViewable: (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false
  5871. };
  5872. }, []);
  5873. const {
  5874. editPost
  5875. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5876. if (!isViewable || (0,external_lodash_namespaceObject.isEmpty)(availableTemplates)) {
  5877. return null;
  5878. }
  5879. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
  5880. label: (0,external_wp_i18n_namespaceObject.__)('Template:'),
  5881. value: selectedTemplate,
  5882. onChange: templateSlug => {
  5883. editPost({
  5884. template: templateSlug || ''
  5885. });
  5886. },
  5887. options: (0,external_lodash_namespaceObject.map)(availableTemplates, (templateName, templateSlug) => ({
  5888. value: templateSlug,
  5889. label: templateName
  5890. }))
  5891. });
  5892. }
  5893. /* harmony default export */ var post_template = (PostTemplate);
  5894. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/constants.js
  5895. const AUTHORS_QUERY = {
  5896. who: 'authors',
  5897. per_page: 50,
  5898. _fields: 'id,name',
  5899. context: 'view' // Allows non-admins to perform requests.
  5900. };
  5901. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js
  5902. /**
  5903. * External dependencies
  5904. */
  5905. /**
  5906. * WordPress dependencies
  5907. */
  5908. /**
  5909. * Internal dependencies
  5910. */
  5911. function PostAuthorCombobox() {
  5912. const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)();
  5913. const {
  5914. authorId,
  5915. isLoading,
  5916. authors,
  5917. postAuthor
  5918. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5919. const {
  5920. getUser,
  5921. getUsers,
  5922. isResolving
  5923. } = select(external_wp_coreData_namespaceObject.store);
  5924. const {
  5925. getEditedPostAttribute
  5926. } = select(store_store);
  5927. const author = getUser(getEditedPostAttribute('author'), {
  5928. context: 'view'
  5929. });
  5930. const query = { ...AUTHORS_QUERY
  5931. };
  5932. if (fieldValue) {
  5933. query.search = fieldValue;
  5934. }
  5935. return {
  5936. authorId: getEditedPostAttribute('author'),
  5937. postAuthor: author,
  5938. authors: getUsers(query),
  5939. isLoading: isResolving('core', 'getUsers', [query])
  5940. };
  5941. }, [fieldValue]);
  5942. const {
  5943. editPost
  5944. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5945. const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
  5946. const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => {
  5947. return {
  5948. value: author.id,
  5949. label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name)
  5950. };
  5951. }); // Ensure the current author is included in the dropdown list.
  5952. const foundAuthor = fetchedAuthors.findIndex(_ref => {
  5953. let {
  5954. value
  5955. } = _ref;
  5956. return (postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor.id) === value;
  5957. });
  5958. if (foundAuthor < 0 && postAuthor) {
  5959. return [{
  5960. value: postAuthor.id,
  5961. label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name)
  5962. }, ...fetchedAuthors];
  5963. }
  5964. return fetchedAuthors;
  5965. }, [authors, postAuthor]);
  5966. /**
  5967. * Handle author selection.
  5968. *
  5969. * @param {number} postAuthorId The selected Author.
  5970. */
  5971. const handleSelect = postAuthorId => {
  5972. if (!postAuthorId) {
  5973. return;
  5974. }
  5975. editPost({
  5976. author: postAuthorId
  5977. });
  5978. };
  5979. /**
  5980. * Handle user input.
  5981. *
  5982. * @param {string} inputValue The current value of the input field.
  5983. */
  5984. const handleKeydown = inputValue => {
  5985. setFieldValue(inputValue);
  5986. };
  5987. if (!postAuthor) {
  5988. return null;
  5989. }
  5990. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
  5991. label: (0,external_wp_i18n_namespaceObject.__)('Author'),
  5992. options: authorOptions,
  5993. value: authorId,
  5994. onFilterValueChange: (0,external_lodash_namespaceObject.debounce)(handleKeydown, 300),
  5995. onChange: handleSelect,
  5996. isLoading: isLoading,
  5997. allowReset: false
  5998. });
  5999. }
  6000. /* harmony default export */ var combobox = (PostAuthorCombobox);
  6001. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/select.js
  6002. /**
  6003. * WordPress dependencies
  6004. */
  6005. /**
  6006. * Internal dependencies
  6007. */
  6008. function PostAuthorSelect() {
  6009. const {
  6010. editPost
  6011. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6012. const {
  6013. postAuthor,
  6014. authors
  6015. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6016. return {
  6017. postAuthor: select(store_store).getEditedPostAttribute('author'),
  6018. authors: select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY)
  6019. };
  6020. }, []);
  6021. const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
  6022. return (authors !== null && authors !== void 0 ? authors : []).map(author => {
  6023. return {
  6024. value: author.id,
  6025. label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name)
  6026. };
  6027. });
  6028. }, [authors]);
  6029. const setAuthorId = value => {
  6030. const author = Number(value);
  6031. editPost({
  6032. author
  6033. });
  6034. };
  6035. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
  6036. className: "post-author-selector",
  6037. label: (0,external_wp_i18n_namespaceObject.__)('Author'),
  6038. options: authorOptions,
  6039. onChange: setAuthorId,
  6040. value: postAuthor
  6041. });
  6042. }
  6043. /* harmony default export */ var post_author_select = (PostAuthorSelect);
  6044. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js
  6045. /**
  6046. * WordPress dependencies
  6047. */
  6048. /**
  6049. * Internal dependencies
  6050. */
  6051. const minimumUsersForCombobox = 25;
  6052. function PostAuthor() {
  6053. const showCombobox = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6054. const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY);
  6055. return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox;
  6056. }, []);
  6057. if (showCombobox) {
  6058. return (0,external_wp_element_namespaceObject.createElement)(combobox, null);
  6059. }
  6060. return (0,external_wp_element_namespaceObject.createElement)(post_author_select, null);
  6061. }
  6062. /* harmony default export */ var post_author = (PostAuthor);
  6063. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js
  6064. /**
  6065. * External dependencies
  6066. */
  6067. /**
  6068. * WordPress dependencies
  6069. */
  6070. /**
  6071. * Internal dependencies
  6072. */
  6073. function PostAuthorCheck(_ref) {
  6074. let {
  6075. children
  6076. } = _ref;
  6077. const {
  6078. hasAssignAuthorAction,
  6079. hasAuthors
  6080. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6081. const post = select(store_store).getCurrentPost();
  6082. const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY);
  6083. return {
  6084. hasAssignAuthorAction: (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-assign-author'], false),
  6085. hasAuthors: (authors === null || authors === void 0 ? void 0 : authors.length) >= 1
  6086. };
  6087. }, []);
  6088. if (!hasAssignAuthorAction || !hasAuthors) {
  6089. return null;
  6090. }
  6091. return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
  6092. supportKeys: "author"
  6093. }, children);
  6094. }
  6095. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js
  6096. /**
  6097. * WordPress dependencies
  6098. */
  6099. /**
  6100. * Internal dependencies
  6101. */
  6102. function PostComments(_ref) {
  6103. let {
  6104. commentStatus = 'open',
  6105. ...props
  6106. } = _ref;
  6107. const onToggleComments = () => props.editPost({
  6108. comment_status: commentStatus === 'open' ? 'closed' : 'open'
  6109. });
  6110. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  6111. label: (0,external_wp_i18n_namespaceObject.__)('Allow comments'),
  6112. checked: commentStatus === 'open',
  6113. onChange: onToggleComments
  6114. });
  6115. }
  6116. /* harmony default export */ var post_comments = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  6117. return {
  6118. commentStatus: select(store_store).getEditedPostAttribute('comment_status')
  6119. };
  6120. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  6121. editPost: dispatch(store_store).editPost
  6122. }))])(PostComments));
  6123. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js
  6124. /**
  6125. * WordPress dependencies
  6126. */
  6127. /**
  6128. * Internal dependencies
  6129. */
  6130. function PostExcerpt(_ref) {
  6131. let {
  6132. excerpt,
  6133. onUpdateExcerpt
  6134. } = _ref;
  6135. return (0,external_wp_element_namespaceObject.createElement)("div", {
  6136. className: "editor-post-excerpt"
  6137. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, {
  6138. label: (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (optional)'),
  6139. className: "editor-post-excerpt__textarea",
  6140. onChange: value => onUpdateExcerpt(value),
  6141. value: excerpt
  6142. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  6143. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/settings-sidebar/#excerpt')
  6144. }, (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts')));
  6145. }
  6146. /* harmony default export */ var post_excerpt = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  6147. return {
  6148. excerpt: select(store_store).getEditedPostAttribute('excerpt')
  6149. };
  6150. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  6151. onUpdateExcerpt(excerpt) {
  6152. dispatch(store_store).editPost({
  6153. excerpt
  6154. });
  6155. }
  6156. }))])(PostExcerpt));
  6157. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js
  6158. /**
  6159. * Internal dependencies
  6160. */
  6161. function PostExcerptCheck(props) {
  6162. return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, {
  6163. supportKeys: "excerpt"
  6164. }));
  6165. }
  6166. /* harmony default export */ var post_excerpt_check = (PostExcerptCheck);
  6167. ;// CONCATENATED MODULE: external ["wp","blob"]
  6168. var external_wp_blob_namespaceObject = window["wp"]["blob"];
  6169. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js
  6170. /**
  6171. * External dependencies
  6172. */
  6173. /**
  6174. * WordPress dependencies
  6175. */
  6176. /**
  6177. * Internal dependencies
  6178. */
  6179. function ThemeSupportCheck(_ref) {
  6180. let {
  6181. themeSupports,
  6182. children,
  6183. postType,
  6184. supportKeys
  6185. } = _ref;
  6186. const isSupported = (0,external_lodash_namespaceObject.some)((0,external_lodash_namespaceObject.castArray)(supportKeys), key => {
  6187. const supported = (0,external_lodash_namespaceObject.get)(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types.
  6188. // In the latter case, we need to verify `postType` exists
  6189. // within `supported`. If `postType` isn't passed, then the check
  6190. // should fail.
  6191. if ('post-thumbnails' === key && Array.isArray(supported)) {
  6192. return (0,external_lodash_namespaceObject.includes)(supported, postType);
  6193. }
  6194. return supported;
  6195. });
  6196. if (!isSupported) {
  6197. return null;
  6198. }
  6199. return children;
  6200. }
  6201. /* harmony default export */ var theme_support_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  6202. const {
  6203. getThemeSupports
  6204. } = select(external_wp_coreData_namespaceObject.store);
  6205. const {
  6206. getEditedPostAttribute
  6207. } = select(store_store);
  6208. return {
  6209. postType: getEditedPostAttribute('type'),
  6210. themeSupports: getThemeSupports()
  6211. };
  6212. })(ThemeSupportCheck));
  6213. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js
  6214. /**
  6215. * Internal dependencies
  6216. */
  6217. function PostFeaturedImageCheck(props) {
  6218. return (0,external_wp_element_namespaceObject.createElement)(theme_support_check, {
  6219. supportKeys: "post-thumbnails"
  6220. }, (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, {
  6221. supportKeys: "thumbnail"
  6222. })));
  6223. }
  6224. /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck);
  6225. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js
  6226. /**
  6227. * External dependencies
  6228. */
  6229. /**
  6230. * WordPress dependencies
  6231. */
  6232. /**
  6233. * Internal dependencies
  6234. */
  6235. const ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present.
  6236. const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image');
  6237. const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Set featured image');
  6238. const DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Remove image');
  6239. const instructions = (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.'));
  6240. function getMediaDetails(media, postId) {
  6241. var _media$media_details$, _media$media_details, _media$media_details$2, _media$media_details2;
  6242. if (!media) {
  6243. return {};
  6244. }
  6245. const defaultSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'large', media.id, postId);
  6246. if (defaultSize in ((_media$media_details$ = media === null || media === void 0 ? void 0 : (_media$media_details = media.media_details) === null || _media$media_details === void 0 ? void 0 : _media$media_details.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) {
  6247. return {
  6248. mediaWidth: media.media_details.sizes[defaultSize].width,
  6249. mediaHeight: media.media_details.sizes[defaultSize].height,
  6250. mediaSourceUrl: media.media_details.sizes[defaultSize].source_url
  6251. };
  6252. } // Use fallbackSize when defaultSize is not available.
  6253. const fallbackSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, postId);
  6254. if (fallbackSize in ((_media$media_details$2 = media === null || media === void 0 ? void 0 : (_media$media_details2 = media.media_details) === null || _media$media_details2 === void 0 ? void 0 : _media$media_details2.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) {
  6255. return {
  6256. mediaWidth: media.media_details.sizes[fallbackSize].width,
  6257. mediaHeight: media.media_details.sizes[fallbackSize].height,
  6258. mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url
  6259. };
  6260. } // Use full image size when fallbackSize and defaultSize are not available.
  6261. return {
  6262. mediaWidth: media.media_details.width,
  6263. mediaHeight: media.media_details.height,
  6264. mediaSourceUrl: media.source_url
  6265. };
  6266. }
  6267. function PostFeaturedImage(_ref) {
  6268. var _media$media_details$3, _media$media_details$4;
  6269. let {
  6270. currentPostId,
  6271. featuredImageId,
  6272. onUpdateImage,
  6273. onRemoveImage,
  6274. media,
  6275. postType,
  6276. noticeUI,
  6277. noticeOperations
  6278. } = _ref;
  6279. const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false);
  6280. const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6281. return select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload;
  6282. }, []);
  6283. const postLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels'], {});
  6284. const {
  6285. mediaWidth,
  6286. mediaHeight,
  6287. mediaSourceUrl
  6288. } = getMediaDetails(media, currentPostId);
  6289. function onDropFiles(filesList) {
  6290. mediaUpload({
  6291. allowedTypes: ['image'],
  6292. filesList,
  6293. onFileChange(_ref2) {
  6294. let [image] = _ref2;
  6295. if ((0,external_wp_blob_namespaceObject.isBlobURL)(image === null || image === void 0 ? void 0 : image.url)) {
  6296. setIsLoading(true);
  6297. return;
  6298. }
  6299. onUpdateImage(image);
  6300. setIsLoading(false);
  6301. },
  6302. onError(message) {
  6303. noticeOperations.removeAllNotices();
  6304. noticeOperations.createErrorNotice(message);
  6305. }
  6306. });
  6307. }
  6308. return (0,external_wp_element_namespaceObject.createElement)(post_featured_image_check, null, noticeUI, (0,external_wp_element_namespaceObject.createElement)("div", {
  6309. className: "editor-post-featured-image"
  6310. }, media && (0,external_wp_element_namespaceObject.createElement)("div", {
  6311. id: `editor-post-featured-image-${featuredImageId}-describedby`,
  6312. className: "hidden"
  6313. }, media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image alt text.
  6314. (0,external_wp_i18n_namespaceObject.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image filename.
  6315. (0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), ((_media$media_details$3 = media.media_details.sizes) === null || _media$media_details$3 === void 0 ? void 0 : (_media$media_details$4 = _media$media_details$3.full) === null || _media$media_details$4 === void 0 ? void 0 : _media$media_details$4.file) || media.slug)), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, {
  6316. fallback: instructions
  6317. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
  6318. title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
  6319. onSelect: onUpdateImage,
  6320. unstableFeaturedImageFlow: true,
  6321. allowedTypes: ALLOWED_MEDIA_TYPES,
  6322. modalClass: "editor-post-featured-image__media-modal",
  6323. render: _ref3 => {
  6324. let {
  6325. open
  6326. } = _ref3;
  6327. return (0,external_wp_element_namespaceObject.createElement)("div", {
  6328. className: "editor-post-featured-image__container"
  6329. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6330. className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
  6331. onClick: open,
  6332. "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or update the image'),
  6333. "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
  6334. }, !!featuredImageId && media && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ResponsiveWrapper, {
  6335. naturalWidth: mediaWidth,
  6336. naturalHeight: mediaHeight,
  6337. isInline: true
  6338. }, (0,external_wp_element_namespaceObject.createElement)("img", {
  6339. src: mediaSourceUrl,
  6340. alt: ""
  6341. })), isLoading && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), !featuredImageId && !isLoading && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropZone, {
  6342. onFilesDrop: onDropFiles
  6343. }));
  6344. },
  6345. value: featuredImageId
  6346. })), !!featuredImageId && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, media && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
  6347. title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
  6348. onSelect: onUpdateImage,
  6349. unstableFeaturedImageFlow: true,
  6350. allowedTypes: ALLOWED_MEDIA_TYPES,
  6351. modalClass: "editor-post-featured-image__media-modal",
  6352. render: _ref4 => {
  6353. let {
  6354. open
  6355. } = _ref4;
  6356. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6357. onClick: open,
  6358. variant: "secondary"
  6359. }, (0,external_wp_i18n_namespaceObject.__)('Replace Image'));
  6360. }
  6361. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6362. onClick: onRemoveImage,
  6363. variant: "link",
  6364. isDestructive: true
  6365. }, postLabel.remove_featured_image || DEFAULT_REMOVE_FEATURE_IMAGE_LABEL))));
  6366. }
  6367. const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => {
  6368. const {
  6369. getMedia,
  6370. getPostType
  6371. } = select(external_wp_coreData_namespaceObject.store);
  6372. const {
  6373. getCurrentPostId,
  6374. getEditedPostAttribute
  6375. } = select(store_store);
  6376. const featuredImageId = getEditedPostAttribute('featured_media');
  6377. return {
  6378. media: featuredImageId ? getMedia(featuredImageId, {
  6379. context: 'view'
  6380. }) : null,
  6381. currentPostId: getCurrentPostId(),
  6382. postType: getPostType(getEditedPostAttribute('type')),
  6383. featuredImageId
  6384. };
  6385. });
  6386. const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref5, _ref6) => {
  6387. let {
  6388. noticeOperations
  6389. } = _ref5;
  6390. let {
  6391. select
  6392. } = _ref6;
  6393. const {
  6394. editPost
  6395. } = dispatch(store_store);
  6396. return {
  6397. onUpdateImage(image) {
  6398. editPost({
  6399. featured_media: image.id
  6400. });
  6401. },
  6402. onDropImage(filesList) {
  6403. select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({
  6404. allowedTypes: ['image'],
  6405. filesList,
  6406. onFileChange(_ref7) {
  6407. let [image] = _ref7;
  6408. editPost({
  6409. featured_media: image.id
  6410. });
  6411. },
  6412. onError(message) {
  6413. noticeOperations.removeAllNotices();
  6414. noticeOperations.createErrorNotice(message);
  6415. }
  6416. });
  6417. },
  6418. onRemoveImage() {
  6419. editPost({
  6420. featured_media: 0
  6421. });
  6422. }
  6423. };
  6424. });
  6425. /* harmony default export */ var post_featured_image = ((0,external_wp_compose_namespaceObject.compose)(external_wp_components_namespaceObject.withNotices, applyWithSelect, applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.PostFeaturedImage'))(PostFeaturedImage));
  6426. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js
  6427. /**
  6428. * WordPress dependencies
  6429. */
  6430. /**
  6431. * Internal dependencies
  6432. */
  6433. function PostFormatCheck(_ref) {
  6434. let {
  6435. disablePostFormats,
  6436. ...props
  6437. } = _ref;
  6438. return !disablePostFormats && (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, {
  6439. supportKeys: "post-formats"
  6440. }));
  6441. }
  6442. /* harmony default export */ var post_format_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  6443. const editorSettings = select(store_store).getEditorSettings();
  6444. return {
  6445. disablePostFormats: editorSettings.disablePostFormats
  6446. };
  6447. })(PostFormatCheck));
  6448. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js
  6449. /**
  6450. * External dependencies
  6451. */
  6452. /**
  6453. * WordPress dependencies
  6454. */
  6455. /**
  6456. * Internal dependencies
  6457. */
  6458. // All WP post formats, sorted alphabetically by translated name.
  6459. const POST_FORMATS = [{
  6460. id: 'aside',
  6461. caption: (0,external_wp_i18n_namespaceObject.__)('Aside')
  6462. }, {
  6463. id: 'audio',
  6464. caption: (0,external_wp_i18n_namespaceObject.__)('Audio')
  6465. }, {
  6466. id: 'chat',
  6467. caption: (0,external_wp_i18n_namespaceObject.__)('Chat')
  6468. }, {
  6469. id: 'gallery',
  6470. caption: (0,external_wp_i18n_namespaceObject.__)('Gallery')
  6471. }, {
  6472. id: 'image',
  6473. caption: (0,external_wp_i18n_namespaceObject.__)('Image')
  6474. }, {
  6475. id: 'link',
  6476. caption: (0,external_wp_i18n_namespaceObject.__)('Link')
  6477. }, {
  6478. id: 'quote',
  6479. caption: (0,external_wp_i18n_namespaceObject.__)('Quote')
  6480. }, {
  6481. id: 'standard',
  6482. caption: (0,external_wp_i18n_namespaceObject.__)('Standard')
  6483. }, {
  6484. id: 'status',
  6485. caption: (0,external_wp_i18n_namespaceObject.__)('Status')
  6486. }, {
  6487. id: 'video',
  6488. caption: (0,external_wp_i18n_namespaceObject.__)('Video')
  6489. }].sort((a, b) => {
  6490. const normalizedA = a.caption.toUpperCase();
  6491. const normalizedB = b.caption.toUpperCase();
  6492. if (normalizedA < normalizedB) {
  6493. return -1;
  6494. }
  6495. if (normalizedA > normalizedB) {
  6496. return 1;
  6497. }
  6498. return 0;
  6499. });
  6500. function PostFormat() {
  6501. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat);
  6502. const postFormatSelectorId = `post-format-selector-${instanceId}`;
  6503. const {
  6504. postFormat,
  6505. suggestedFormat,
  6506. supportedFormats
  6507. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6508. const {
  6509. getEditedPostAttribute,
  6510. getSuggestedPostFormat
  6511. } = select(store_store);
  6512. const _postFormat = getEditedPostAttribute('format');
  6513. const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports();
  6514. return {
  6515. postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard',
  6516. suggestedFormat: getSuggestedPostFormat(),
  6517. supportedFormats: themeSupports.formats
  6518. };
  6519. }, []);
  6520. const formats = POST_FORMATS.filter(format => {
  6521. // Ensure current format is always in the set.
  6522. // The current format may not be a format supported by the theme.
  6523. return (0,external_lodash_namespaceObject.includes)(supportedFormats, format.id) || postFormat === format.id;
  6524. });
  6525. const suggestion = (0,external_lodash_namespaceObject.find)(formats, format => format.id === suggestedFormat);
  6526. const {
  6527. editPost
  6528. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6529. const onUpdatePostFormat = format => editPost({
  6530. format
  6531. });
  6532. return (0,external_wp_element_namespaceObject.createElement)(post_format_check, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  6533. className: "editor-post-format"
  6534. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
  6535. label: (0,external_wp_i18n_namespaceObject.__)('Post Format'),
  6536. value: postFormat,
  6537. onChange: format => onUpdatePostFormat(format),
  6538. id: postFormatSelectorId,
  6539. options: formats.map(format => ({
  6540. label: format.caption,
  6541. value: format.id
  6542. }))
  6543. }), suggestion && suggestion.id !== postFormat && (0,external_wp_element_namespaceObject.createElement)("p", {
  6544. className: "editor-post-format__suggestion"
  6545. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6546. variant: "link",
  6547. onClick: () => onUpdatePostFormat(suggestion.id)
  6548. }, (0,external_wp_i18n_namespaceObject.sprintf)(
  6549. /* translators: %s: post format */
  6550. (0,external_wp_i18n_namespaceObject.__)('Apply suggested format: %s'), suggestion.caption)))));
  6551. }
  6552. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js
  6553. /**
  6554. * WordPress dependencies
  6555. */
  6556. const backup = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  6557. xmlns: "http://www.w3.org/2000/svg",
  6558. viewBox: "0 0 24 24"
  6559. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  6560. d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
  6561. }));
  6562. /* harmony default export */ var library_backup = (backup);
  6563. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js
  6564. /**
  6565. * WordPress dependencies
  6566. */
  6567. /**
  6568. * Internal dependencies
  6569. */
  6570. function PostLastRevisionCheck(_ref) {
  6571. let {
  6572. lastRevisionId,
  6573. revisionsCount,
  6574. children
  6575. } = _ref;
  6576. if (!lastRevisionId || revisionsCount < 2) {
  6577. return null;
  6578. }
  6579. return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
  6580. supportKeys: "revisions"
  6581. }, children);
  6582. }
  6583. /* harmony default export */ var post_last_revision_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  6584. const {
  6585. getCurrentPostLastRevisionId,
  6586. getCurrentPostRevisionsCount
  6587. } = select(store_store);
  6588. return {
  6589. lastRevisionId: getCurrentPostLastRevisionId(),
  6590. revisionsCount: getCurrentPostRevisionsCount()
  6591. };
  6592. })(PostLastRevisionCheck));
  6593. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js
  6594. /**
  6595. * WordPress dependencies
  6596. */
  6597. /**
  6598. * Internal dependencies
  6599. */
  6600. function LastRevision(_ref) {
  6601. let {
  6602. lastRevisionId,
  6603. revisionsCount
  6604. } = _ref;
  6605. return (0,external_wp_element_namespaceObject.createElement)(post_last_revision_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6606. href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
  6607. revision: lastRevisionId,
  6608. gutenberg: true
  6609. }),
  6610. className: "editor-post-last-revision__title",
  6611. icon: library_backup
  6612. }, (0,external_wp_i18n_namespaceObject.sprintf)(
  6613. /* translators: %d: number of revisions */
  6614. (0,external_wp_i18n_namespaceObject._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount)));
  6615. }
  6616. /* harmony default export */ var post_last_revision = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  6617. const {
  6618. getCurrentPostLastRevisionId,
  6619. getCurrentPostRevisionsCount
  6620. } = select(store_store);
  6621. return {
  6622. lastRevisionId: getCurrentPostLastRevisionId(),
  6623. revisionsCount: getCurrentPostRevisionsCount()
  6624. };
  6625. })(LastRevision));
  6626. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js
  6627. /**
  6628. * External dependencies
  6629. */
  6630. /**
  6631. * WordPress dependencies
  6632. */
  6633. /**
  6634. * Internal dependencies
  6635. */
  6636. function PostLockedModal() {
  6637. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal);
  6638. const hookName = 'core/editor/post-locked-modal-' + instanceId;
  6639. const {
  6640. autosave,
  6641. updatePostLock
  6642. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6643. const {
  6644. isLocked,
  6645. isTakeover,
  6646. user,
  6647. postId,
  6648. postLockUtils,
  6649. activePostLock,
  6650. postType,
  6651. previewLink
  6652. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6653. const {
  6654. isPostLocked,
  6655. isPostLockTakeover,
  6656. getPostLockUser,
  6657. getCurrentPostId,
  6658. getActivePostLock,
  6659. getEditedPostAttribute,
  6660. getEditedPostPreviewLink,
  6661. getEditorSettings
  6662. } = select(store_store);
  6663. const {
  6664. getPostType
  6665. } = select(external_wp_coreData_namespaceObject.store);
  6666. return {
  6667. isLocked: isPostLocked(),
  6668. isTakeover: isPostLockTakeover(),
  6669. user: getPostLockUser(),
  6670. postId: getCurrentPostId(),
  6671. postLockUtils: getEditorSettings().postLockUtils,
  6672. activePostLock: getActivePostLock(),
  6673. postType: getPostType(getEditedPostAttribute('type')),
  6674. previewLink: getEditedPostPreviewLink()
  6675. };
  6676. }, []);
  6677. (0,external_wp_element_namespaceObject.useEffect)(() => {
  6678. /**
  6679. * Keep the lock refreshed.
  6680. *
  6681. * When the user does not send a heartbeat in a heartbeat-tick
  6682. * the user is no longer editing and another user can start editing.
  6683. *
  6684. * @param {Object} data Data to send in the heartbeat request.
  6685. */
  6686. function sendPostLock(data) {
  6687. if (isLocked) {
  6688. return;
  6689. }
  6690. data['wp-refresh-post-lock'] = {
  6691. lock: activePostLock,
  6692. post_id: postId
  6693. };
  6694. }
  6695. /**
  6696. * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.
  6697. *
  6698. * @param {Object} data Data received in the heartbeat request
  6699. */
  6700. function receivePostLock(data) {
  6701. if (!data['wp-refresh-post-lock']) {
  6702. return;
  6703. }
  6704. const received = data['wp-refresh-post-lock'];
  6705. if (received.lock_error) {
  6706. // Auto save and display the takeover modal.
  6707. autosave();
  6708. updatePostLock({
  6709. isLocked: true,
  6710. isTakeover: true,
  6711. user: {
  6712. name: received.lock_error.name,
  6713. avatar: received.lock_error.avatar_src_2x
  6714. }
  6715. });
  6716. } else if (received.new_lock) {
  6717. updatePostLock({
  6718. isLocked: false,
  6719. activePostLock: received.new_lock
  6720. });
  6721. }
  6722. }
  6723. /**
  6724. * Unlock the post before the window is exited.
  6725. */
  6726. function releasePostLock() {
  6727. if (isLocked || !activePostLock) {
  6728. return;
  6729. }
  6730. const data = new window.FormData();
  6731. data.append('action', 'wp-remove-post-lock');
  6732. data.append('_wpnonce', postLockUtils.unlockNonce);
  6733. data.append('post_ID', postId);
  6734. data.append('active_post_lock', activePostLock);
  6735. if (window.navigator.sendBeacon) {
  6736. window.navigator.sendBeacon(postLockUtils.ajaxUrl, data);
  6737. } else {
  6738. const xhr = new window.XMLHttpRequest();
  6739. xhr.open('POST', postLockUtils.ajaxUrl, false);
  6740. xhr.send(data);
  6741. }
  6742. } // Details on these events on the Heartbeat API docs
  6743. // https://developer.wordpress.org/plugins/javascript/heartbeat-api/
  6744. (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.send', hookName, sendPostLock);
  6745. (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.tick', hookName, receivePostLock);
  6746. window.addEventListener('beforeunload', releasePostLock);
  6747. return () => {
  6748. (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.send', hookName);
  6749. (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.tick', hookName);
  6750. window.removeEventListener('beforeunload', releasePostLock);
  6751. };
  6752. }, []);
  6753. if (!isLocked) {
  6754. return null;
  6755. }
  6756. const userDisplayName = user.name;
  6757. const userAvatar = user.avatar;
  6758. const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', {
  6759. 'get-post-lock': '1',
  6760. lockKey: true,
  6761. post: postId,
  6762. action: 'edit',
  6763. _wpnonce: postLockUtils.nonce
  6764. });
  6765. const allPostsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
  6766. post_type: (0,external_lodash_namespaceObject.get)(postType, ['slug'])
  6767. });
  6768. const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)('Exit editor');
  6769. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  6770. title: isTakeover ? (0,external_wp_i18n_namespaceObject.__)('Someone else has taken over this post') : (0,external_wp_i18n_namespaceObject.__)('This post is already being edited'),
  6771. focusOnMount: true,
  6772. shouldCloseOnClickOutside: false,
  6773. shouldCloseOnEsc: false,
  6774. isDismissible: false,
  6775. className: "editor-post-locked-modal"
  6776. }, !!userAvatar && (0,external_wp_element_namespaceObject.createElement)("img", {
  6777. src: userAvatar,
  6778. alt: (0,external_wp_i18n_namespaceObject.__)('Avatar'),
  6779. className: "editor-post-locked-modal__avatar",
  6780. width: 64,
  6781. height: 64
  6782. }), (0,external_wp_element_namespaceObject.createElement)("div", null, !!isTakeover && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)(
  6783. /* translators: %s: user's display name */
  6784. (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), {
  6785. strong: (0,external_wp_element_namespaceObject.createElement)("strong", null),
  6786. PreviewLink: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  6787. href: previewLink
  6788. }, (0,external_wp_i18n_namespaceObject.__)('preview'))
  6789. })), !isTakeover && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)(
  6790. /* translators: %s: user's display name */
  6791. (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), {
  6792. strong: (0,external_wp_element_namespaceObject.createElement)("strong", null),
  6793. PreviewLink: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  6794. href: previewLink
  6795. }, (0,external_wp_i18n_namespaceObject.__)('preview'))
  6796. })), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('If you take over, the other user will lose editing control to the post, but their changes will be saved.'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  6797. className: "editor-post-locked-modal__buttons",
  6798. justify: "flex-end",
  6799. expanded: false
  6800. }, !isTakeover && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6801. variant: "tertiary",
  6802. href: unlockUrl
  6803. }, (0,external_wp_i18n_namespaceObject.__)('Take over'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6804. variant: "primary",
  6805. href: allPostsUrl
  6806. }, allPostsLabel)))));
  6807. }
  6808. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js
  6809. /**
  6810. * External dependencies
  6811. */
  6812. /**
  6813. * WordPress dependencies
  6814. */
  6815. /**
  6816. * Internal dependencies
  6817. */
  6818. function PostPendingStatusCheck(_ref) {
  6819. let {
  6820. hasPublishAction,
  6821. isPublished,
  6822. children
  6823. } = _ref;
  6824. if (isPublished || !hasPublishAction) {
  6825. return null;
  6826. }
  6827. return children;
  6828. }
  6829. /* harmony default export */ var post_pending_status_check = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => {
  6830. const {
  6831. isCurrentPostPublished,
  6832. getCurrentPostType,
  6833. getCurrentPost
  6834. } = select(store_store);
  6835. return {
  6836. hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  6837. isPublished: isCurrentPostPublished(),
  6838. postType: getCurrentPostType()
  6839. };
  6840. }))(PostPendingStatusCheck));
  6841. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js
  6842. /**
  6843. * WordPress dependencies
  6844. */
  6845. /**
  6846. * Internal dependencies
  6847. */
  6848. function PostPendingStatus(_ref) {
  6849. let {
  6850. status,
  6851. onUpdateStatus
  6852. } = _ref;
  6853. const togglePendingStatus = () => {
  6854. const updatedStatus = status === 'pending' ? 'draft' : 'pending';
  6855. onUpdateStatus(updatedStatus);
  6856. };
  6857. return (0,external_wp_element_namespaceObject.createElement)(post_pending_status_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  6858. label: (0,external_wp_i18n_namespaceObject.__)('Pending review'),
  6859. checked: status === 'pending',
  6860. onChange: togglePendingStatus
  6861. }));
  6862. }
  6863. /* harmony default export */ var post_pending_status = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
  6864. status: select(store_store).getEditedPostAttribute('status')
  6865. })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  6866. onUpdateStatus(status) {
  6867. dispatch(store_store).editPost({
  6868. status
  6869. });
  6870. }
  6871. })))(PostPendingStatus));
  6872. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js
  6873. /**
  6874. * WordPress dependencies
  6875. */
  6876. /**
  6877. * Internal dependencies
  6878. */
  6879. function PostPingbacks(_ref) {
  6880. let {
  6881. pingStatus = 'open',
  6882. ...props
  6883. } = _ref;
  6884. const onTogglePingback = () => props.editPost({
  6885. ping_status: pingStatus === 'open' ? 'closed' : 'open'
  6886. });
  6887. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  6888. label: (0,external_wp_i18n_namespaceObject.__)('Allow pingbacks & trackbacks'),
  6889. checked: pingStatus === 'open',
  6890. onChange: onTogglePingback
  6891. });
  6892. }
  6893. /* harmony default export */ var post_pingbacks = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  6894. return {
  6895. pingStatus: select(store_store).getEditedPostAttribute('ping_status')
  6896. };
  6897. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  6898. editPost: dispatch(store_store).editPost
  6899. }))])(PostPingbacks));
  6900. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js
  6901. /**
  6902. * External dependencies
  6903. */
  6904. /**
  6905. * WordPress dependencies
  6906. */
  6907. /**
  6908. * Internal dependencies
  6909. */
  6910. function writeInterstitialMessage(targetDocument) {
  6911. let markup = (0,external_wp_element_namespaceObject.renderToString)((0,external_wp_element_namespaceObject.createElement)("div", {
  6912. className: "editor-post-preview-button__interstitial-message"
  6913. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
  6914. xmlns: "http://www.w3.org/2000/svg",
  6915. viewBox: "0 0 96 96"
  6916. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
  6917. className: "outer",
  6918. d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",
  6919. fill: "none"
  6920. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
  6921. className: "inner",
  6922. 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",
  6923. fill: "none"
  6924. })), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Generating preview…'))));
  6925. markup += `
  6926. <style>
  6927. body {
  6928. margin: 0;
  6929. }
  6930. .editor-post-preview-button__interstitial-message {
  6931. display: flex;
  6932. flex-direction: column;
  6933. align-items: center;
  6934. justify-content: center;
  6935. height: 100vh;
  6936. width: 100vw;
  6937. }
  6938. @-webkit-keyframes paint {
  6939. 0% {
  6940. stroke-dashoffset: 0;
  6941. }
  6942. }
  6943. @-moz-keyframes paint {
  6944. 0% {
  6945. stroke-dashoffset: 0;
  6946. }
  6947. }
  6948. @-o-keyframes paint {
  6949. 0% {
  6950. stroke-dashoffset: 0;
  6951. }
  6952. }
  6953. @keyframes paint {
  6954. 0% {
  6955. stroke-dashoffset: 0;
  6956. }
  6957. }
  6958. .editor-post-preview-button__interstitial-message svg {
  6959. width: 192px;
  6960. height: 192px;
  6961. stroke: #555d66;
  6962. stroke-width: 0.75;
  6963. }
  6964. .editor-post-preview-button__interstitial-message svg .outer,
  6965. .editor-post-preview-button__interstitial-message svg .inner {
  6966. stroke-dasharray: 280;
  6967. stroke-dashoffset: 280;
  6968. -webkit-animation: paint 1.5s ease infinite alternate;
  6969. -moz-animation: paint 1.5s ease infinite alternate;
  6970. -o-animation: paint 1.5s ease infinite alternate;
  6971. animation: paint 1.5s ease infinite alternate;
  6972. }
  6973. p {
  6974. text-align: center;
  6975. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  6976. }
  6977. </style>
  6978. `;
  6979. /**
  6980. * Filters the interstitial message shown when generating previews.
  6981. *
  6982. * @param {string} markup The preview interstitial markup.
  6983. */
  6984. markup = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostPreview.interstitialMarkup', markup);
  6985. targetDocument.write(markup);
  6986. targetDocument.title = (0,external_wp_i18n_namespaceObject.__)('Generating preview…');
  6987. targetDocument.close();
  6988. }
  6989. class PostPreviewButton extends external_wp_element_namespaceObject.Component {
  6990. constructor() {
  6991. super(...arguments);
  6992. this.buttonRef = (0,external_wp_element_namespaceObject.createRef)();
  6993. this.openPreviewWindow = this.openPreviewWindow.bind(this);
  6994. }
  6995. componentDidUpdate(prevProps) {
  6996. const {
  6997. previewLink
  6998. } = this.props; // This relies on the window being responsible to unset itself when
  6999. // navigation occurs or a new preview window is opened, to avoid
  7000. // unintentional forceful redirects.
  7001. if (previewLink && !prevProps.previewLink) {
  7002. this.setPreviewWindowLink(previewLink);
  7003. }
  7004. }
  7005. /**
  7006. * Sets the preview window's location to the given URL, if a preview window
  7007. * exists and is not closed.
  7008. *
  7009. * @param {string} url URL to assign as preview window location.
  7010. */
  7011. setPreviewWindowLink(url) {
  7012. const {
  7013. previewWindow
  7014. } = this;
  7015. if (previewWindow && !previewWindow.closed) {
  7016. previewWindow.location = url;
  7017. if (this.buttonRef.current) {
  7018. this.buttonRef.current.focus();
  7019. }
  7020. }
  7021. }
  7022. getWindowTarget() {
  7023. const {
  7024. postId
  7025. } = this.props;
  7026. return `wp-preview-${postId}`;
  7027. }
  7028. openPreviewWindow(event) {
  7029. // Our Preview button has its 'href' and 'target' set correctly for a11y
  7030. // purposes. Unfortunately, though, we can't rely on the default 'click'
  7031. // handler since sometimes it incorrectly opens a new tab instead of reusing
  7032. // the existing one.
  7033. // https://github.com/WordPress/gutenberg/pull/8330
  7034. event.preventDefault(); // Open up a Preview tab if needed. This is where we'll show the preview.
  7035. if (!this.previewWindow || this.previewWindow.closed) {
  7036. this.previewWindow = window.open('', this.getWindowTarget());
  7037. } // Focus the Preview tab. This might not do anything, depending on the browser's
  7038. // and user's preferences.
  7039. // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus
  7040. this.previewWindow.focus();
  7041. if ( // If we don't need to autosave the post before previewing, then we simply
  7042. // load the Preview URL in the Preview tab.
  7043. !this.props.isAutosaveable || // Do not save or overwrite the post, if the post is already locked.
  7044. this.props.isPostLocked) {
  7045. this.setPreviewWindowLink(event.target.href);
  7046. return;
  7047. } // Request an autosave. This happens asynchronously and causes the component
  7048. // to update when finished.
  7049. if (this.props.isDraft) {
  7050. this.props.savePost({
  7051. isPreview: true
  7052. });
  7053. } else {
  7054. this.props.autosave({
  7055. isPreview: true
  7056. });
  7057. } // Display a 'Generating preview' message in the Preview tab while we wait for the
  7058. // autosave to finish.
  7059. writeInterstitialMessage(this.previewWindow.document);
  7060. }
  7061. render() {
  7062. const {
  7063. previewLink,
  7064. currentPostLink,
  7065. isSaveable,
  7066. role
  7067. } = this.props; // Link to the `?preview=true` URL if we have it, since this lets us see
  7068. // changes that were autosaved since the post was last published. Otherwise,
  7069. // just link to the post's URL.
  7070. const href = previewLink || currentPostLink;
  7071. const classNames = classnames_default()({
  7072. 'editor-post-preview': !this.props.className
  7073. }, this.props.className);
  7074. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  7075. variant: !this.props.className ? 'tertiary' : undefined,
  7076. className: classNames,
  7077. href: href,
  7078. target: this.getWindowTarget(),
  7079. disabled: !isSaveable,
  7080. onClick: this.openPreviewWindow,
  7081. ref: this.buttonRef,
  7082. role: role
  7083. }, this.props.textContent ? this.props.textContent : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject._x)('Preview', 'imperative verb'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  7084. as: "span"
  7085. },
  7086. /* translators: accessibility text */
  7087. (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))));
  7088. }
  7089. }
  7090. /* harmony default export */ var post_preview_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
  7091. let {
  7092. forcePreviewLink,
  7093. forceIsAutosaveable
  7094. } = _ref;
  7095. const {
  7096. getCurrentPostId,
  7097. getCurrentPostAttribute,
  7098. getEditedPostAttribute,
  7099. isEditedPostSaveable,
  7100. isEditedPostAutosaveable,
  7101. getEditedPostPreviewLink,
  7102. isPostLocked
  7103. } = select(store_store);
  7104. const {
  7105. getPostType
  7106. } = select(external_wp_coreData_namespaceObject.store);
  7107. const previewLink = getEditedPostPreviewLink();
  7108. const postType = getPostType(getEditedPostAttribute('type'));
  7109. return {
  7110. postId: getCurrentPostId(),
  7111. currentPostLink: getCurrentPostAttribute('link'),
  7112. previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink,
  7113. isSaveable: isEditedPostSaveable(),
  7114. isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),
  7115. isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false),
  7116. isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1,
  7117. isPostLocked: isPostLocked()
  7118. };
  7119. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  7120. autosave: dispatch(store_store).autosave,
  7121. savePost: dispatch(store_store).savePost
  7122. })), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
  7123. let {
  7124. isViewable
  7125. } = _ref2;
  7126. return isViewable;
  7127. })])(PostPreviewButton));
  7128. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js
  7129. /**
  7130. * External dependencies
  7131. */
  7132. /**
  7133. * WordPress dependencies
  7134. */
  7135. /**
  7136. * Internal dependencies
  7137. */
  7138. function PublishButtonLabel(_ref) {
  7139. let {
  7140. isPublished,
  7141. isBeingScheduled,
  7142. isSaving,
  7143. isPublishing,
  7144. hasPublishAction,
  7145. isAutosaving,
  7146. hasNonPostEntityChanges
  7147. } = _ref;
  7148. if (isPublishing) {
  7149. /* translators: button label text should, if possible, be under 16 characters. */
  7150. return (0,external_wp_i18n_namespaceObject.__)('Publishing…');
  7151. } else if (isPublished && isSaving && !isAutosaving) {
  7152. /* translators: button label text should, if possible, be under 16 characters. */
  7153. return (0,external_wp_i18n_namespaceObject.__)('Updating…');
  7154. } else if (isBeingScheduled && isSaving && !isAutosaving) {
  7155. /* translators: button label text should, if possible, be under 16 characters. */
  7156. return (0,external_wp_i18n_namespaceObject.__)('Scheduling…');
  7157. }
  7158. if (!hasPublishAction) {
  7159. return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Submit for Review…') : (0,external_wp_i18n_namespaceObject.__)('Submit for Review');
  7160. } else if (isPublished) {
  7161. return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Update…') : (0,external_wp_i18n_namespaceObject.__)('Update');
  7162. } else if (isBeingScheduled) {
  7163. return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Schedule');
  7164. }
  7165. return (0,external_wp_i18n_namespaceObject.__)('Publish');
  7166. }
  7167. /* harmony default export */ var label = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => {
  7168. let {
  7169. forceIsSaving
  7170. } = _ref2;
  7171. const {
  7172. isCurrentPostPublished,
  7173. isEditedPostBeingScheduled,
  7174. isSavingPost,
  7175. isPublishingPost,
  7176. getCurrentPost,
  7177. getCurrentPostType,
  7178. isAutosavingPost
  7179. } = select(store_store);
  7180. return {
  7181. isPublished: isCurrentPostPublished(),
  7182. isBeingScheduled: isEditedPostBeingScheduled(),
  7183. isSaving: forceIsSaving || isSavingPost(),
  7184. isPublishing: isPublishingPost(),
  7185. hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  7186. postType: getCurrentPostType(),
  7187. isAutosaving: isAutosavingPost()
  7188. };
  7189. })])(PublishButtonLabel));
  7190. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js
  7191. /**
  7192. * External dependencies
  7193. */
  7194. /**
  7195. * WordPress dependencies
  7196. */
  7197. /**
  7198. * Internal dependencies
  7199. */
  7200. const noop = () => {};
  7201. class PostPublishButton extends external_wp_element_namespaceObject.Component {
  7202. constructor(props) {
  7203. super(props);
  7204. this.buttonNode = (0,external_wp_element_namespaceObject.createRef)();
  7205. this.createOnClick = this.createOnClick.bind(this);
  7206. this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this);
  7207. this.state = {
  7208. entitiesSavedStatesCallback: false
  7209. };
  7210. }
  7211. componentDidMount() {
  7212. if (this.props.focusOnMount) {
  7213. this.buttonNode.current.focus();
  7214. }
  7215. }
  7216. createOnClick(callback) {
  7217. var _this = this;
  7218. return function () {
  7219. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  7220. args[_key] = arguments[_key];
  7221. }
  7222. const {
  7223. hasNonPostEntityChanges,
  7224. setEntitiesSavedStatesCallback
  7225. } = _this.props; // If a post with non-post entities is published, but the user
  7226. // elects to not save changes to the non-post entities, those
  7227. // entities will still be dirty when the Publish button is clicked.
  7228. // We also need to check that the `setEntitiesSavedStatesCallback`
  7229. // prop was passed. See https://github.com/WordPress/gutenberg/pull/37383
  7230. if (hasNonPostEntityChanges && setEntitiesSavedStatesCallback) {
  7231. // The modal for multiple entity saving will open,
  7232. // hold the callback for saving/publishing the post
  7233. // so that we can call it if the post entity is checked.
  7234. _this.setState({
  7235. entitiesSavedStatesCallback: () => callback(...args)
  7236. }); // Open the save panel by setting its callback.
  7237. // To set a function on the useState hook, we must set it
  7238. // with another function (() => myFunction). Passing the
  7239. // function on its own will cause an error when called.
  7240. setEntitiesSavedStatesCallback(() => _this.closeEntitiesSavedStates);
  7241. return noop;
  7242. }
  7243. return callback(...args);
  7244. };
  7245. }
  7246. closeEntitiesSavedStates(savedEntities) {
  7247. const {
  7248. postType,
  7249. postId
  7250. } = this.props;
  7251. const {
  7252. entitiesSavedStatesCallback
  7253. } = this.state;
  7254. this.setState({
  7255. entitiesSavedStatesCallback: false
  7256. }, () => {
  7257. if (savedEntities && (0,external_lodash_namespaceObject.some)(savedEntities, elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) {
  7258. // The post entity was checked, call the held callback from `createOnClick`.
  7259. entitiesSavedStatesCallback();
  7260. }
  7261. });
  7262. }
  7263. render() {
  7264. const {
  7265. forceIsDirty,
  7266. forceIsSaving,
  7267. hasPublishAction,
  7268. isBeingScheduled,
  7269. isOpen,
  7270. isPostSavingLocked,
  7271. isPublishable,
  7272. isPublished,
  7273. isSaveable,
  7274. isSaving,
  7275. isAutoSaving,
  7276. isToggle,
  7277. onSave,
  7278. onStatusChange,
  7279. onSubmit = noop,
  7280. onToggle,
  7281. visibility,
  7282. hasNonPostEntityChanges,
  7283. isSavingNonPostEntityChanges
  7284. } = this.props;
  7285. const isButtonDisabled = (isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges);
  7286. const isToggleDisabled = (isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges);
  7287. let publishStatus;
  7288. if (!hasPublishAction) {
  7289. publishStatus = 'pending';
  7290. } else if (visibility === 'private') {
  7291. publishStatus = 'private';
  7292. } else if (isBeingScheduled) {
  7293. publishStatus = 'future';
  7294. } else {
  7295. publishStatus = 'publish';
  7296. }
  7297. const onClickButton = () => {
  7298. if (isButtonDisabled) {
  7299. return;
  7300. }
  7301. onSubmit();
  7302. onStatusChange(publishStatus);
  7303. onSave();
  7304. };
  7305. const onClickToggle = () => {
  7306. if (isToggleDisabled) {
  7307. return;
  7308. }
  7309. onToggle();
  7310. };
  7311. const buttonProps = {
  7312. 'aria-disabled': isButtonDisabled,
  7313. className: 'editor-post-publish-button',
  7314. isBusy: !isAutoSaving && isSaving && isPublished,
  7315. variant: 'primary',
  7316. onClick: this.createOnClick(onClickButton)
  7317. };
  7318. const toggleProps = {
  7319. 'aria-disabled': isToggleDisabled,
  7320. 'aria-expanded': isOpen,
  7321. className: 'editor-post-publish-panel__toggle',
  7322. isBusy: isSaving && isPublished,
  7323. variant: 'primary',
  7324. onClick: this.createOnClick(onClickToggle)
  7325. };
  7326. const toggleChildren = isBeingScheduled ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Publish');
  7327. const buttonChildren = (0,external_wp_element_namespaceObject.createElement)(label, {
  7328. forceIsSaving: forceIsSaving,
  7329. hasNonPostEntityChanges: hasNonPostEntityChanges
  7330. });
  7331. const componentProps = isToggle ? toggleProps : buttonProps;
  7332. const componentChildren = isToggle ? toggleChildren : buttonChildren;
  7333. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({
  7334. ref: this.buttonNode
  7335. }, componentProps, {
  7336. className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', {
  7337. 'has-changes-dot': hasNonPostEntityChanges
  7338. })
  7339. }), componentChildren));
  7340. }
  7341. }
  7342. /* harmony default export */ var post_publish_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  7343. const {
  7344. isSavingPost,
  7345. isAutosavingPost,
  7346. isEditedPostBeingScheduled,
  7347. getEditedPostVisibility,
  7348. isCurrentPostPublished,
  7349. isEditedPostSaveable,
  7350. isEditedPostPublishable,
  7351. isPostSavingLocked,
  7352. getCurrentPost,
  7353. getCurrentPostType,
  7354. getCurrentPostId,
  7355. hasNonPostEntityChanges,
  7356. isSavingNonPostEntityChanges
  7357. } = select(store_store);
  7358. const _isAutoSaving = isAutosavingPost();
  7359. return {
  7360. isSaving: isSavingPost() || _isAutoSaving,
  7361. isAutoSaving: _isAutoSaving,
  7362. isBeingScheduled: isEditedPostBeingScheduled(),
  7363. visibility: getEditedPostVisibility(),
  7364. isSaveable: isEditedPostSaveable(),
  7365. isPostSavingLocked: isPostSavingLocked(),
  7366. isPublishable: isEditedPostPublishable(),
  7367. isPublished: isCurrentPostPublished(),
  7368. hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  7369. postType: getCurrentPostType(),
  7370. postId: getCurrentPostId(),
  7371. hasNonPostEntityChanges: hasNonPostEntityChanges(),
  7372. isSavingNonPostEntityChanges: isSavingNonPostEntityChanges()
  7373. };
  7374. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  7375. const {
  7376. editPost,
  7377. savePost
  7378. } = dispatch(store_store);
  7379. return {
  7380. onStatusChange: status => editPost({
  7381. status
  7382. }, {
  7383. undoIgnore: true
  7384. }),
  7385. onSave: savePost
  7386. };
  7387. })])(PostPublishButton));
  7388. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
  7389. /**
  7390. * WordPress dependencies
  7391. */
  7392. const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  7393. xmlns: "http://www.w3.org/2000/svg",
  7394. viewBox: "0 0 24 24"
  7395. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  7396. d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
  7397. }));
  7398. /* harmony default export */ var close_small = (closeSmall);
  7399. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
  7400. /**
  7401. * WordPress dependencies
  7402. */
  7403. const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  7404. xmlns: "http://www.w3.org/2000/svg",
  7405. viewBox: "-2 -2 24 24"
  7406. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  7407. d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
  7408. }));
  7409. /* harmony default export */ var library_wordpress = (wordpress);
  7410. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js
  7411. /**
  7412. * WordPress dependencies
  7413. */
  7414. const visibilityOptions = {
  7415. public: {
  7416. label: (0,external_wp_i18n_namespaceObject.__)('Public'),
  7417. info: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.')
  7418. },
  7419. private: {
  7420. label: (0,external_wp_i18n_namespaceObject.__)('Private'),
  7421. info: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.')
  7422. },
  7423. password: {
  7424. label: (0,external_wp_i18n_namespaceObject.__)('Password protected'),
  7425. info: (0,external_wp_i18n_namespaceObject.__)('Only those with the password can view this post.')
  7426. }
  7427. };
  7428. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js
  7429. /**
  7430. * WordPress dependencies
  7431. */
  7432. /**
  7433. * Internal dependencies
  7434. */
  7435. function PostVisibility(_ref) {
  7436. let {
  7437. onClose
  7438. } = _ref;
  7439. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostVisibility);
  7440. const {
  7441. status,
  7442. visibility,
  7443. password
  7444. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  7445. status: select(store_store).getEditedPostAttribute('status'),
  7446. visibility: select(store_store).getEditedPostVisibility(),
  7447. password: select(store_store).getEditedPostAttribute('password')
  7448. }));
  7449. const {
  7450. editPost,
  7451. savePost
  7452. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  7453. const [hasPassword, setHasPassword] = (0,external_wp_element_namespaceObject.useState)(!!password);
  7454. const [showPrivateConfirmDialog, setShowPrivateConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false);
  7455. const setPublic = () => {
  7456. editPost({
  7457. status: visibility === 'private' ? 'draft' : status,
  7458. password: ''
  7459. });
  7460. setHasPassword(false);
  7461. };
  7462. const setPrivate = () => {
  7463. setShowPrivateConfirmDialog(true);
  7464. };
  7465. const confirmPrivate = () => {
  7466. editPost({
  7467. status: 'private',
  7468. password: ''
  7469. });
  7470. setHasPassword(false);
  7471. setShowPrivateConfirmDialog(false);
  7472. savePost();
  7473. };
  7474. const handleDialogCancel = () => {
  7475. setShowPrivateConfirmDialog(false);
  7476. };
  7477. const setPasswordProtected = () => {
  7478. editPost({
  7479. status: visibility === 'private' ? 'draft' : status,
  7480. password: password || ''
  7481. });
  7482. setHasPassword(true);
  7483. };
  7484. const updatePassword = event => {
  7485. editPost({
  7486. password: event.target.value
  7487. });
  7488. };
  7489. return (0,external_wp_element_namespaceObject.createElement)("div", {
  7490. className: "editor-post-visibility"
  7491. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
  7492. title: (0,external_wp_i18n_namespaceObject.__)('Visibility'),
  7493. help: (0,external_wp_i18n_namespaceObject.__)('Control how this post is viewed.'),
  7494. onClose: onClose
  7495. }), (0,external_wp_element_namespaceObject.createElement)("fieldset", {
  7496. className: "editor-post-visibility__fieldset"
  7497. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  7498. as: "legend"
  7499. }, (0,external_wp_i18n_namespaceObject.__)('Visibility')), (0,external_wp_element_namespaceObject.createElement)(PostVisibilityChoice, {
  7500. instanceId: instanceId,
  7501. value: "public",
  7502. label: visibilityOptions["public"].label,
  7503. info: visibilityOptions["public"].info,
  7504. checked: visibility === 'public' && !hasPassword,
  7505. onChange: setPublic
  7506. }), (0,external_wp_element_namespaceObject.createElement)(PostVisibilityChoice, {
  7507. instanceId: instanceId,
  7508. value: "private",
  7509. label: visibilityOptions["private"].label,
  7510. info: visibilityOptions["private"].info,
  7511. checked: visibility === 'private',
  7512. onChange: setPrivate
  7513. }), (0,external_wp_element_namespaceObject.createElement)(PostVisibilityChoice, {
  7514. instanceId: instanceId,
  7515. value: "password",
  7516. label: visibilityOptions.password.label,
  7517. info: visibilityOptions.password.info,
  7518. checked: hasPassword,
  7519. onChange: setPasswordProtected
  7520. }), hasPassword && (0,external_wp_element_namespaceObject.createElement)("div", {
  7521. className: "editor-post-visibility__password"
  7522. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  7523. as: "label",
  7524. htmlFor: `editor-post-visibility__password-input-${instanceId}`
  7525. }, (0,external_wp_i18n_namespaceObject.__)('Create password')), (0,external_wp_element_namespaceObject.createElement)("input", {
  7526. className: "editor-post-visibility__password-input",
  7527. id: `editor-post-visibility__password-input-${instanceId}`,
  7528. type: "text",
  7529. onChange: updatePassword,
  7530. value: password,
  7531. placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password')
  7532. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
  7533. isOpen: showPrivateConfirmDialog,
  7534. onConfirm: confirmPrivate,
  7535. onCancel: handleDialogCancel
  7536. }, (0,external_wp_i18n_namespaceObject.__)('Would you like to privately publish this post now?')));
  7537. }
  7538. function PostVisibilityChoice(_ref2) {
  7539. let {
  7540. instanceId,
  7541. value,
  7542. label,
  7543. info,
  7544. ...props
  7545. } = _ref2;
  7546. return (0,external_wp_element_namespaceObject.createElement)("div", {
  7547. className: "editor-post-visibility__choice"
  7548. }, (0,external_wp_element_namespaceObject.createElement)("input", _extends({
  7549. type: "radio",
  7550. name: `editor-post-visibility__setting-${instanceId}`,
  7551. value: value,
  7552. id: `editor-post-${value}-${instanceId}`,
  7553. "aria-describedby": `editor-post-${value}-${instanceId}-description`,
  7554. className: "editor-post-visibility__radio"
  7555. }, props)), (0,external_wp_element_namespaceObject.createElement)("label", {
  7556. htmlFor: `editor-post-${value}-${instanceId}`,
  7557. className: "editor-post-visibility__label"
  7558. }, label), (0,external_wp_element_namespaceObject.createElement)("p", {
  7559. id: `editor-post-${value}-${instanceId}-description`,
  7560. className: "editor-post-visibility__info"
  7561. }, info));
  7562. }
  7563. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js
  7564. /**
  7565. * WordPress dependencies
  7566. */
  7567. /**
  7568. * Internal dependencies
  7569. */
  7570. function PostVisibilityLabel() {
  7571. return usePostVisibilityLabel();
  7572. }
  7573. function usePostVisibilityLabel() {
  7574. var _visibilityOptions$vi;
  7575. const visibility = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostVisibility());
  7576. return (_visibilityOptions$vi = visibilityOptions[visibility]) === null || _visibilityOptions$vi === void 0 ? void 0 : _visibilityOptions$vi.label;
  7577. }
  7578. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js
  7579. /**
  7580. * WordPress dependencies
  7581. */
  7582. /**
  7583. * Internal dependencies
  7584. */
  7585. function getDayOfTheMonth() {
  7586. let date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  7587. let firstDay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  7588. const d = new Date(date);
  7589. return new Date(d.getFullYear(), d.getMonth() + (firstDay ? 0 : 1), firstDay ? 1 : 0).toISOString();
  7590. }
  7591. function PostSchedule(_ref) {
  7592. let {
  7593. onClose
  7594. } = _ref;
  7595. const {
  7596. postDate,
  7597. postType
  7598. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  7599. postDate: select(store_store).getEditedPostAttribute('date'),
  7600. postType: select(store_store).getCurrentPostType()
  7601. }), []);
  7602. const {
  7603. editPost
  7604. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  7605. const onUpdateDate = date => editPost({
  7606. date
  7607. });
  7608. const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)(getDayOfTheMonth(postDate)); // Pick up published and schduled site posts.
  7609. const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, {
  7610. status: 'publish,future',
  7611. after: getDayOfTheMonth(previewedMonth),
  7612. before: getDayOfTheMonth(previewedMonth, false),
  7613. exclude: [select(store_store).getCurrentPostId()]
  7614. }), [previewedMonth, postType]);
  7615. const events = (0,external_wp_element_namespaceObject.useMemo)(() => (eventsByPostType || []).map(_ref2 => {
  7616. let {
  7617. title,
  7618. type,
  7619. date: eventDate
  7620. } = _ref2;
  7621. return {
  7622. title: title === null || title === void 0 ? void 0 : title.rendered,
  7623. type,
  7624. date: new Date(eventDate)
  7625. };
  7626. }), [eventsByPostType]);
  7627. const settings = (0,external_wp_date_namespaceObject.getSettings)(); // To know if the current timezone is a 12 hour time with look for "a" in the time format
  7628. // We also make sure this a is not escaped by a "/"
  7629. const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a.
  7630. .replace(/\\\\/g, '') // Replace "//" with empty strings.
  7631. .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash.
  7632. );
  7633. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPublishDateTimePicker, {
  7634. currentDate: postDate,
  7635. onChange: onUpdateDate,
  7636. is12Hour: is12HourTime,
  7637. events: events,
  7638. onMonthPreviewed: setPreviewedMonth,
  7639. onClose: onClose
  7640. });
  7641. }
  7642. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js
  7643. /**
  7644. * WordPress dependencies
  7645. */
  7646. /**
  7647. * Internal dependencies
  7648. */
  7649. function PostScheduleLabel(props) {
  7650. return usePostScheduleLabel(props);
  7651. }
  7652. function usePostScheduleLabel() {
  7653. let {
  7654. full = false
  7655. } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7656. const {
  7657. date,
  7658. isFloating
  7659. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  7660. date: select(store_store).getEditedPostAttribute('date'),
  7661. isFloating: select(store_store).isEditedPostDateFloating()
  7662. }), []);
  7663. return full ? getFullPostScheduleLabel(date) : getPostScheduleLabel(date, {
  7664. isFloating
  7665. });
  7666. }
  7667. function getFullPostScheduleLabel(dateAttribute) {
  7668. const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute);
  7669. const timezoneAbbreviation = getTimezoneAbbreviation();
  7670. const formattedDate = (0,external_wp_date_namespaceObject.dateI18n)( // translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.
  7671. (0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
  7672. return (0,external_wp_i18n_namespaceObject.isRTL)() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`;
  7673. }
  7674. function getPostScheduleLabel(dateAttribute) {
  7675. let {
  7676. isFloating = false,
  7677. now = new Date()
  7678. } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  7679. if (!dateAttribute || isFloating) {
  7680. return (0,external_wp_i18n_namespaceObject.__)('Immediately');
  7681. } // If the user timezone does not equal the site timezone then using words
  7682. // like 'tomorrow' is confusing, so show the full date.
  7683. if (!isTimezoneSameAsSiteTimezone(now)) {
  7684. return getFullPostScheduleLabel(dateAttribute);
  7685. }
  7686. const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute);
  7687. if (isSameDay(date, now)) {
  7688. return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Time of day the post is scheduled for.
  7689. (0,external_wp_i18n_namespaceObject.__)('Today at %s'), // translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.
  7690. (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date));
  7691. }
  7692. const tomorrow = new Date(now);
  7693. tomorrow.setDate(tomorrow.getDate() + 1);
  7694. if (isSameDay(date, tomorrow)) {
  7695. return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Time of day the post is scheduled for.
  7696. (0,external_wp_i18n_namespaceObject.__)('Tomorrow at %s'), // translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.
  7697. (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date));
  7698. }
  7699. if (date.getFullYear() === now.getFullYear()) {
  7700. return (0,external_wp_date_namespaceObject.dateI18n)( // translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.
  7701. (0,external_wp_i18n_namespaceObject._x)('F j g:i\xa0a', 'post schedule date format without year'), date);
  7702. }
  7703. return (0,external_wp_date_namespaceObject.dateI18n)( // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
  7704. (0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
  7705. }
  7706. function getTimezoneAbbreviation() {
  7707. const {
  7708. timezone
  7709. } = (0,external_wp_date_namespaceObject.getSettings)();
  7710. if (timezone.abbr && isNaN(Number(timezone.abbr))) {
  7711. return timezone.abbr;
  7712. }
  7713. const symbol = timezone.offset < 0 ? '' : '+';
  7714. return `UTC${symbol}${timezone.offset}`;
  7715. }
  7716. function isTimezoneSameAsSiteTimezone(date) {
  7717. const {
  7718. timezone
  7719. } = (0,external_wp_date_namespaceObject.getSettings)();
  7720. const siteOffset = Number(timezone.offset);
  7721. const dateOffset = -1 * (date.getTimezoneOffset() / 60);
  7722. return siteOffset === dateOffset;
  7723. }
  7724. function isSameDay(left, right) {
  7725. return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear();
  7726. }
  7727. ;// CONCATENATED MODULE: external ["wp","a11y"]
  7728. var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
  7729. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js
  7730. /**
  7731. * External dependencies
  7732. */
  7733. /**
  7734. * WordPress dependencies
  7735. */
  7736. /**
  7737. * Internal dependencies
  7738. */
  7739. const MIN_MOST_USED_TERMS = 3;
  7740. const DEFAULT_QUERY = {
  7741. per_page: 10,
  7742. orderby: 'count',
  7743. order: 'desc',
  7744. hide_empty: true,
  7745. _fields: 'id,name,count',
  7746. context: 'view'
  7747. };
  7748. function MostUsedTerms(_ref) {
  7749. let {
  7750. onSelect,
  7751. taxonomy
  7752. } = _ref;
  7753. const {
  7754. _terms,
  7755. showTerms
  7756. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7757. const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY);
  7758. return {
  7759. _terms: mostUsedTerms,
  7760. showTerms: (mostUsedTerms === null || mostUsedTerms === void 0 ? void 0 : mostUsedTerms.length) >= MIN_MOST_USED_TERMS
  7761. };
  7762. }, []);
  7763. if (!showTerms) {
  7764. return null;
  7765. }
  7766. const terms = unescapeTerms(_terms);
  7767. const label = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'most_used']);
  7768. return (0,external_wp_element_namespaceObject.createElement)("div", {
  7769. className: "editor-post-taxonomies__flat-term-most-used"
  7770. }, (0,external_wp_element_namespaceObject.createElement)("h3", {
  7771. className: "editor-post-taxonomies__flat-term-most-used-label"
  7772. }, label), (0,external_wp_element_namespaceObject.createElement)("ul", {
  7773. role: "list",
  7774. className: "editor-post-taxonomies__flat-term-most-used-list"
  7775. }, terms.map(term => (0,external_wp_element_namespaceObject.createElement)("li", {
  7776. key: term.id
  7777. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  7778. variant: "link",
  7779. onClick: () => onSelect(term)
  7780. }, term.name)))));
  7781. }
  7782. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js
  7783. /**
  7784. * External dependencies
  7785. */
  7786. /**
  7787. * WordPress dependencies
  7788. */
  7789. /**
  7790. * Internal dependencies
  7791. */
  7792. /**
  7793. * Shared reference to an empty array for cases where it is important to avoid
  7794. * returning a new array reference on every invocation.
  7795. *
  7796. * @type {Array<any>}
  7797. */
  7798. const flat_term_selector_EMPTY_ARRAY = [];
  7799. /**
  7800. * Module constants
  7801. */
  7802. const MAX_TERMS_SUGGESTIONS = 20;
  7803. const flat_term_selector_DEFAULT_QUERY = {
  7804. per_page: MAX_TERMS_SUGGESTIONS,
  7805. orderby: 'count',
  7806. order: 'desc',
  7807. _fields: 'id,name',
  7808. context: 'view'
  7809. };
  7810. const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase();
  7811. const termNamesToIds = (names, terms) => {
  7812. return names.map(termName => (0,external_lodash_namespaceObject.find)(terms, term => isSameTermName(term.name, termName)).id);
  7813. }; // Tries to create a term or fetch it if it already exists.
  7814. function findOrCreateTerm(termName, restBase, namespace) {
  7815. const escapedTermName = (0,external_lodash_namespaceObject.escape)(termName);
  7816. return external_wp_apiFetch_default()({
  7817. path: `/${namespace}/${restBase}`,
  7818. method: 'POST',
  7819. data: {
  7820. name: escapedTermName
  7821. }
  7822. }).catch(error => {
  7823. if (error.code !== 'term_exists') {
  7824. return Promise.reject(error);
  7825. }
  7826. return Promise.resolve({
  7827. id: error.data.term_id,
  7828. name: termName
  7829. });
  7830. }).then(unescapeTerm);
  7831. }
  7832. function FlatTermSelector(_ref) {
  7833. let {
  7834. slug
  7835. } = _ref;
  7836. const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]);
  7837. const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)('');
  7838. const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500);
  7839. const {
  7840. terms,
  7841. termIds,
  7842. taxonomy,
  7843. hasAssignAction,
  7844. hasCreateAction,
  7845. hasResolvedTerms
  7846. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7847. const {
  7848. getCurrentPost,
  7849. getEditedPostAttribute
  7850. } = select(store_store);
  7851. const {
  7852. getEntityRecords,
  7853. getTaxonomy,
  7854. hasFinishedResolution
  7855. } = select(external_wp_coreData_namespaceObject.store);
  7856. const post = getCurrentPost();
  7857. const _taxonomy = getTaxonomy(slug);
  7858. const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY;
  7859. const query = { ...flat_term_selector_DEFAULT_QUERY,
  7860. include: _termIds.join(','),
  7861. per_page: -1
  7862. };
  7863. return {
  7864. hasCreateAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-create-' + _taxonomy.rest_base], false) : false,
  7865. hasAssignAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-assign-' + _taxonomy.rest_base], false) : false,
  7866. taxonomy: _taxonomy,
  7867. termIds: _termIds,
  7868. terms: _termIds.length ? getEntityRecords('taxonomy', slug, query) : flat_term_selector_EMPTY_ARRAY,
  7869. hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query])
  7870. };
  7871. }, [slug]);
  7872. const {
  7873. searchResults
  7874. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7875. const {
  7876. getEntityRecords
  7877. } = select(external_wp_coreData_namespaceObject.store);
  7878. return {
  7879. searchResults: !!search ? getEntityRecords('taxonomy', slug, { ...flat_term_selector_DEFAULT_QUERY,
  7880. search
  7881. }) : flat_term_selector_EMPTY_ARRAY
  7882. };
  7883. }, [search]); // Update terms state only after the selectors are resolved.
  7884. // We're using this to avoid terms temporarily disappearing on slow networks
  7885. // while core data makes REST API requests.
  7886. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7887. if (hasResolvedTerms) {
  7888. const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => unescapeString(term.name));
  7889. setValues(newValues);
  7890. }
  7891. }, [terms, hasResolvedTerms]);
  7892. const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => {
  7893. return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name));
  7894. }, [searchResults]);
  7895. const {
  7896. editPost
  7897. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  7898. if (!hasAssignAction) {
  7899. return null;
  7900. }
  7901. function onUpdateTerms(newTermIds) {
  7902. editPost({
  7903. [taxonomy.rest_base]: newTermIds
  7904. });
  7905. }
  7906. function onChange(termNames) {
  7907. var _taxonomy$rest_namesp;
  7908. const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
  7909. const uniqueTerms = termNames.reduce((acc, name) => {
  7910. if (!acc.some(n => n.toLowerCase() === name.toLowerCase())) {
  7911. acc.push(name);
  7912. }
  7913. return acc;
  7914. }, []);
  7915. const newTermNames = uniqueTerms.filter(termName => !(0,external_lodash_namespaceObject.find)(availableTerms, term => isSameTermName(term.name, termName))); // Optimistically update term values.
  7916. // The selector will always re-fetch terms later.
  7917. setValues(uniqueTerms);
  7918. if (newTermNames.length === 0) {
  7919. return onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
  7920. }
  7921. if (!hasCreateAction) {
  7922. return;
  7923. }
  7924. const namespace = (_taxonomy$rest_namesp = taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.rest_namespace) !== null && _taxonomy$rest_namesp !== void 0 ? _taxonomy$rest_namesp : 'wp/v2';
  7925. Promise.all(newTermNames.map(termName => findOrCreateTerm(termName, taxonomy.rest_base, namespace))).then(newTerms => {
  7926. const newAvailableTerms = availableTerms.concat(newTerms);
  7927. return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
  7928. });
  7929. }
  7930. function appendTerm(newTerm) {
  7931. if (termIds.includes(newTerm.id)) {
  7932. return;
  7933. }
  7934. const newTermIds = [...termIds, newTerm.id];
  7935. const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
  7936. /* translators: %s: term name. */
  7937. (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term')));
  7938. (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive');
  7939. onUpdateTerms(newTermIds);
  7940. }
  7941. const newTermLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Add new tag') : (0,external_wp_i18n_namespaceObject.__)('Add new Term'));
  7942. const singularName = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term'));
  7943. const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
  7944. /* translators: %s: term name. */
  7945. (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), singularName);
  7946. const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
  7947. /* translators: %s: term name. */
  7948. (0,external_wp_i18n_namespaceObject._x)('%s removed', 'term'), singularName);
  7949. const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
  7950. /* translators: %s: term name. */
  7951. (0,external_wp_i18n_namespaceObject._x)('Remove %s', 'term'), singularName);
  7952. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, {
  7953. value: values,
  7954. suggestions: suggestions,
  7955. onChange: onChange,
  7956. onInputChange: debouncedSearch,
  7957. maxSuggestions: MAX_TERMS_SUGGESTIONS,
  7958. label: newTermLabel,
  7959. messages: {
  7960. added: termAddedLabel,
  7961. removed: termRemovedLabel,
  7962. remove: removeTermLabel
  7963. }
  7964. }), (0,external_wp_element_namespaceObject.createElement)(MostUsedTerms, {
  7965. taxonomy: taxonomy,
  7966. onSelect: appendTerm
  7967. }));
  7968. }
  7969. /* harmony default export */ var flat_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(FlatTermSelector));
  7970. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js
  7971. /**
  7972. * External dependencies
  7973. */
  7974. /**
  7975. * WordPress dependencies
  7976. */
  7977. /**
  7978. * Internal dependencies
  7979. */
  7980. const TagsPanel = () => {
  7981. const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", {
  7982. className: "editor-post-publish-panel__link",
  7983. key: "label"
  7984. }, (0,external_wp_i18n_namespaceObject.__)('Add tags'))];
  7985. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  7986. initialOpen: false,
  7987. title: panelBodyTitle
  7988. }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), (0,external_wp_element_namespaceObject.createElement)(flat_term_selector, {
  7989. slug: 'post_tag'
  7990. }));
  7991. };
  7992. class MaybeTagsPanel extends external_wp_element_namespaceObject.Component {
  7993. constructor(props) {
  7994. super(props);
  7995. this.state = {
  7996. hadTagsWhenOpeningThePanel: props.hasTags
  7997. };
  7998. }
  7999. /*
  8000. * We only want to show the tag panel if the post didn't have
  8001. * any tags when the user hit the Publish button.
  8002. *
  8003. * We can't use the prop.hasTags because it'll change to true
  8004. * if the user adds a new tag within the pre-publish panel.
  8005. * This would force a re-render and a new prop.hasTags check,
  8006. * hiding this panel and keeping the user from adding
  8007. * more than one tag.
  8008. */
  8009. render() {
  8010. if (!this.state.hadTagsWhenOpeningThePanel) {
  8011. return (0,external_wp_element_namespaceObject.createElement)(TagsPanel, null);
  8012. }
  8013. return null;
  8014. }
  8015. }
  8016. /* harmony default export */ var maybe_tags_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => {
  8017. const postType = select(store_store).getCurrentPostType();
  8018. const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('post_tag');
  8019. const tags = tagsTaxonomy && select(store_store).getEditedPostAttribute(tagsTaxonomy.rest_base);
  8020. return {
  8021. areTagsFetched: tagsTaxonomy !== undefined,
  8022. isPostTypeSupported: tagsTaxonomy && (0,external_lodash_namespaceObject.some)(tagsTaxonomy.types, type => type === postType),
  8023. hasTags: tags && tags.length
  8024. };
  8025. }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref => {
  8026. let {
  8027. areTagsFetched,
  8028. isPostTypeSupported
  8029. } = _ref;
  8030. return isPostTypeSupported && areTagsFetched;
  8031. }))(MaybeTagsPanel));
  8032. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js
  8033. /**
  8034. * External dependencies
  8035. */
  8036. /**
  8037. * WordPress dependencies
  8038. */
  8039. /**
  8040. * Internal dependencies
  8041. */
  8042. const getSuggestion = (supportedFormats, suggestedPostFormat) => {
  8043. const formats = POST_FORMATS.filter(format => (0,external_lodash_namespaceObject.includes)(supportedFormats, format.id));
  8044. return (0,external_lodash_namespaceObject.find)(formats, format => format.id === suggestedPostFormat);
  8045. };
  8046. const PostFormatSuggestion = _ref => {
  8047. let {
  8048. suggestedPostFormat,
  8049. suggestionText,
  8050. onUpdatePostFormat
  8051. } = _ref;
  8052. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  8053. variant: "link",
  8054. onClick: () => onUpdatePostFormat(suggestedPostFormat)
  8055. }, suggestionText);
  8056. };
  8057. function PostFormatPanel() {
  8058. const {
  8059. currentPostFormat,
  8060. suggestion
  8061. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  8062. const {
  8063. getEditedPostAttribute,
  8064. getSuggestedPostFormat
  8065. } = select(store_store);
  8066. const supportedFormats = (0,external_lodash_namespaceObject.get)(select(external_wp_coreData_namespaceObject.store).getThemeSupports(), ['formats'], []);
  8067. return {
  8068. currentPostFormat: getEditedPostAttribute('format'),
  8069. suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat())
  8070. };
  8071. }, []);
  8072. const {
  8073. editPost
  8074. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  8075. const onUpdatePostFormat = format => editPost({
  8076. format
  8077. });
  8078. const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", {
  8079. className: "editor-post-publish-panel__link",
  8080. key: "label"
  8081. }, (0,external_wp_i18n_namespaceObject.__)('Use a post format'))];
  8082. if (!suggestion || suggestion.id === currentPostFormat) {
  8083. return null;
  8084. }
  8085. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  8086. initialOpen: false,
  8087. title: panelBodyTitle
  8088. }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(PostFormatSuggestion, {
  8089. onUpdatePostFormat: onUpdatePostFormat,
  8090. suggestedPostFormat: suggestion.id,
  8091. suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)(
  8092. /* translators: %s: post format */
  8093. (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption)
  8094. })));
  8095. }
  8096. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js
  8097. /**
  8098. * External dependencies
  8099. */
  8100. /**
  8101. * WordPress dependencies
  8102. */
  8103. /**
  8104. * Internal dependencies
  8105. */
  8106. /**
  8107. * Module Constants
  8108. */
  8109. const hierarchical_term_selector_DEFAULT_QUERY = {
  8110. per_page: -1,
  8111. orderby: 'name',
  8112. order: 'asc',
  8113. _fields: 'id,name,parent',
  8114. context: 'view'
  8115. };
  8116. const MIN_TERMS_COUNT_FOR_FILTER = 8;
  8117. const hierarchical_term_selector_EMPTY_ARRAY = [];
  8118. /**
  8119. * Sort Terms by Selected.
  8120. *
  8121. * @param {Object[]} termsTree Array of terms in tree format.
  8122. * @param {number[]} terms Selected terms.
  8123. *
  8124. * @return {Object[]} Sorted array of terms.
  8125. */
  8126. function sortBySelected(termsTree, terms) {
  8127. const treeHasSelection = termTree => {
  8128. if (terms.indexOf(termTree.id) !== -1) {
  8129. return true;
  8130. }
  8131. if (undefined === termTree.children) {
  8132. return false;
  8133. }
  8134. return termTree.children.map(treeHasSelection).filter(child => child).length > 0;
  8135. };
  8136. const termOrChildIsSelected = (termA, termB) => {
  8137. const termASelected = treeHasSelection(termA);
  8138. const termBSelected = treeHasSelection(termB);
  8139. if (termASelected === termBSelected) {
  8140. return 0;
  8141. }
  8142. if (termASelected && !termBSelected) {
  8143. return -1;
  8144. }
  8145. if (!termASelected && termBSelected) {
  8146. return 1;
  8147. }
  8148. return 0;
  8149. };
  8150. const newTermTree = [...termsTree];
  8151. newTermTree.sort(termOrChildIsSelected);
  8152. return newTermTree;
  8153. }
  8154. /**
  8155. * Find term by parent id or name.
  8156. *
  8157. * @param {Object[]} terms Array of Terms.
  8158. * @param {number|string} parent id.
  8159. * @param {string} name Term name.
  8160. * @return {Object} Term object.
  8161. */
  8162. function findTerm(terms, parent, name) {
  8163. return (0,external_lodash_namespaceObject.find)(terms, term => {
  8164. return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase();
  8165. });
  8166. }
  8167. /**
  8168. * Get filter matcher function.
  8169. *
  8170. * @param {string} filterValue Filter value.
  8171. * @return {(function(Object): (Object|boolean))} Matcher function.
  8172. */
  8173. function getFilterMatcher(filterValue) {
  8174. const matchTermsForFilter = originalTerm => {
  8175. if ('' === filterValue) {
  8176. return originalTerm;
  8177. } // Shallow clone, because we'll be filtering the term's children and
  8178. // don't want to modify the original term.
  8179. const term = { ...originalTerm
  8180. }; // Map and filter the children, recursive so we deal with grandchildren
  8181. // and any deeper levels.
  8182. if (term.children.length > 0) {
  8183. term.children = term.children.map(matchTermsForFilter).filter(child => child);
  8184. } // If the term's name contains the filterValue, or it has children
  8185. // (i.e. some child matched at some point in the tree) then return it.
  8186. if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) {
  8187. return term;
  8188. } // Otherwise, return false. After mapping, the list of terms will need
  8189. // to have false values filtered out.
  8190. return false;
  8191. };
  8192. return matchTermsForFilter;
  8193. }
  8194. /**
  8195. * Hierarchical term selector.
  8196. *
  8197. * @param {Object} props Component props.
  8198. * @param {string} props.slug Taxonomy slug.
  8199. * @return {WPElement} Hierarchical term selector component.
  8200. */
  8201. function HierarchicalTermSelector(_ref) {
  8202. let {
  8203. slug
  8204. } = _ref;
  8205. const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false);
  8206. const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)('');
  8207. /**
  8208. * @type {[number|'', Function]}
  8209. */
  8210. const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)('');
  8211. const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false);
  8212. const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
  8213. const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]);
  8214. const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
  8215. const {
  8216. hasCreateAction,
  8217. hasAssignAction,
  8218. terms,
  8219. loading,
  8220. availableTerms,
  8221. taxonomy
  8222. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  8223. const {
  8224. getCurrentPost,
  8225. getEditedPostAttribute
  8226. } = select(store_store);
  8227. const {
  8228. getTaxonomy,
  8229. getEntityRecords,
  8230. isResolving
  8231. } = select(external_wp_coreData_namespaceObject.store);
  8232. const _taxonomy = getTaxonomy(slug);
  8233. return {
  8234. hasCreateAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-create-' + _taxonomy.rest_base], false) : false,
  8235. hasAssignAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-assign-' + _taxonomy.rest_base], false) : false,
  8236. terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY,
  8237. loading: isResolving('getEntityRecords', ['taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY]),
  8238. availableTerms: getEntityRecords('taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY,
  8239. taxonomy: _taxonomy
  8240. };
  8241. }, [slug]);
  8242. const {
  8243. editPost
  8244. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  8245. const {
  8246. saveEntityRecord
  8247. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  8248. const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)(() => sortBySelected(buildTermsTree(availableTerms), terms), // Remove `terms` from the dependency list to avoid reordering every time
  8249. // checking or unchecking a term.
  8250. [availableTerms]);
  8251. if (!hasAssignAction) {
  8252. return null;
  8253. }
  8254. /**
  8255. * Append new term.
  8256. *
  8257. * @param {Object} term Term object.
  8258. * @return {Promise} A promise that resolves to save term object.
  8259. */
  8260. const addTerm = term => {
  8261. return saveEntityRecord('taxonomy', slug, term);
  8262. };
  8263. /**
  8264. * Update terms for post.
  8265. *
  8266. * @param {number[]} termIds Term ids.
  8267. */
  8268. const onUpdateTerms = termIds => {
  8269. editPost({
  8270. [taxonomy.rest_base]: termIds
  8271. });
  8272. };
  8273. /**
  8274. * Handler for checking term.
  8275. *
  8276. * @param {number} termId
  8277. */
  8278. const onChange = termId => {
  8279. const hasTerm = terms.includes(termId);
  8280. const newTerms = hasTerm ? (0,external_lodash_namespaceObject.without)(terms, termId) : [...terms, termId];
  8281. onUpdateTerms(newTerms);
  8282. };
  8283. const onChangeFormName = value => {
  8284. setFormName(value);
  8285. };
  8286. /**
  8287. * Handler for changing form parent.
  8288. *
  8289. * @param {number|''} parentId Parent post id.
  8290. */
  8291. const onChangeFormParent = parentId => {
  8292. setFormParent(parentId);
  8293. };
  8294. const onToggleForm = () => {
  8295. setShowForm(!showForm);
  8296. };
  8297. const onAddTerm = async event => {
  8298. event.preventDefault();
  8299. if (formName === '' || adding) {
  8300. return;
  8301. } // Check if the term we are adding already exists.
  8302. const existingTerm = findTerm(availableTerms, formParent, formName);
  8303. if (existingTerm) {
  8304. // If the term we are adding exists but is not selected select it.
  8305. if (!(0,external_lodash_namespaceObject.some)(terms, term => term === existingTerm.id)) {
  8306. onUpdateTerms([...terms, existingTerm.id]);
  8307. }
  8308. setFormName('');
  8309. setFormParent('');
  8310. return;
  8311. }
  8312. setAdding(true);
  8313. const newTerm = await addTerm({
  8314. name: formName,
  8315. parent: formParent ? formParent : undefined
  8316. });
  8317. const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
  8318. /* translators: %s: taxonomy name */
  8319. (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'category' ? (0,external_wp_i18n_namespaceObject.__)('Category') : (0,external_wp_i18n_namespaceObject.__)('Term')));
  8320. (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive');
  8321. setAdding(false);
  8322. setFormName('');
  8323. setFormParent('');
  8324. onUpdateTerms([...terms, newTerm.id]);
  8325. };
  8326. const setFilter = value => {
  8327. const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter(term => term);
  8328. const getResultCount = termsTree => {
  8329. let count = 0;
  8330. for (let i = 0; i < termsTree.length; i++) {
  8331. count++;
  8332. if (undefined !== termsTree[i].children) {
  8333. count += getResultCount(termsTree[i].children);
  8334. }
  8335. }
  8336. return count;
  8337. };
  8338. setFilterValue(value);
  8339. setFilteredTermsTree(newFilteredTermsTree);
  8340. const resultCount = getResultCount(newFilteredTermsTree);
  8341. const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
  8342. /* translators: %d: number of results */
  8343. (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', resultCount), resultCount);
  8344. debouncedSpeak(resultsFoundMessage, 'assertive');
  8345. };
  8346. const renderTerms = renderedTerms => {
  8347. return renderedTerms.map(term => {
  8348. return (0,external_wp_element_namespaceObject.createElement)("div", {
  8349. key: term.id,
  8350. className: "editor-post-taxonomies__hierarchical-terms-choice"
  8351. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  8352. checked: terms.indexOf(term.id) !== -1,
  8353. onChange: () => {
  8354. const termId = parseInt(term.id, 10);
  8355. onChange(termId);
  8356. },
  8357. label: (0,external_lodash_namespaceObject.unescape)(term.name)
  8358. }), !!term.children.length && (0,external_wp_element_namespaceObject.createElement)("div", {
  8359. className: "editor-post-taxonomies__hierarchical-terms-subchoices"
  8360. }, renderTerms(term.children)));
  8361. });
  8362. };
  8363. const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory);
  8364. const newTermButtonLabel = labelWithFallback('add_new_item', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term'));
  8365. const newTermLabel = labelWithFallback('new_item_name', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term'));
  8366. const parentSelectLabel = labelWithFallback('parent_item', (0,external_wp_i18n_namespaceObject.__)('Parent Category'), (0,external_wp_i18n_namespaceObject.__)('Parent Term'));
  8367. const noParentOption = `— ${parentSelectLabel} —`;
  8368. const newTermSubmitLabel = newTermButtonLabel;
  8369. const filterLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'search_items'], (0,external_wp_i18n_namespaceObject.__)('Search Terms'));
  8370. const groupLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['name'], (0,external_wp_i18n_namespaceObject.__)('Terms'));
  8371. const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
  8372. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showFilter && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  8373. className: "editor-post-taxonomies__hierarchical-terms-filter",
  8374. label: filterLabel,
  8375. value: filterValue,
  8376. onChange: setFilter
  8377. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  8378. className: "editor-post-taxonomies__hierarchical-terms-list",
  8379. tabIndex: "0",
  8380. role: "group",
  8381. "aria-label": groupLabel
  8382. }, renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  8383. onClick: onToggleForm,
  8384. className: "editor-post-taxonomies__hierarchical-terms-add",
  8385. "aria-expanded": showForm,
  8386. variant: "link"
  8387. }, newTermButtonLabel), showForm && (0,external_wp_element_namespaceObject.createElement)("form", {
  8388. onSubmit: onAddTerm
  8389. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  8390. className: "editor-post-taxonomies__hierarchical-terms-input",
  8391. label: newTermLabel,
  8392. value: formName,
  8393. onChange: onChangeFormName,
  8394. required: true
  8395. }), !!availableTerms.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TreeSelect, {
  8396. label: parentSelectLabel,
  8397. noOptionLabel: noParentOption,
  8398. onChange: onChangeFormParent,
  8399. selectedId: formParent,
  8400. tree: availableTermsTree
  8401. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  8402. variant: "secondary",
  8403. type: "submit",
  8404. className: "editor-post-taxonomies__hierarchical-terms-submit"
  8405. }, newTermSubmitLabel)));
  8406. }
  8407. /* harmony default export */ var hierarchical_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(HierarchicalTermSelector));
  8408. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-category-panel.js
  8409. /**
  8410. * External dependencies
  8411. */
  8412. /**
  8413. * WordPress dependencies
  8414. */
  8415. /**
  8416. * Internal dependencies
  8417. */
  8418. function MaybeCategoryPanel() {
  8419. const hasNoCategory = (0,external_wp_data_namespaceObject.useSelect)(select => {
  8420. var _select$getEntityReco;
  8421. const postType = select(store_store).getCurrentPostType();
  8422. const categoriesTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('category');
  8423. const defaultCategoryId = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.default_category;
  8424. const defaultCategory = select(external_wp_coreData_namespaceObject.store).getEntityRecord('taxonomy', 'category', defaultCategoryId);
  8425. const postTypeSupportsCategories = categoriesTaxonomy && (0,external_lodash_namespaceObject.some)(categoriesTaxonomy.types, type => type === postType);
  8426. const categories = categoriesTaxonomy && select(store_store).getEditedPostAttribute(categoriesTaxonomy.rest_base); // This boolean should return true if everything is loaded
  8427. // ( categoriesTaxonomy, defaultCategory )
  8428. // and the post has not been assigned a category different than "uncategorized".
  8429. return !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && ((categories === null || categories === void 0 ? void 0 : categories.length) === 0 || (categories === null || categories === void 0 ? void 0 : categories.length) === 1 && defaultCategory.id === categories[0]);
  8430. }, []);
  8431. const [shouldShowPanel, setShouldShowPanel] = (0,external_wp_element_namespaceObject.useState)(false);
  8432. (0,external_wp_element_namespaceObject.useEffect)(() => {
  8433. // We use state to avoid hiding the panel if the user edits the categories
  8434. // and adds one within the panel itself (while visible).
  8435. if (hasNoCategory) {
  8436. setShouldShowPanel(true);
  8437. }
  8438. }, [hasNoCategory]);
  8439. if (!shouldShowPanel) {
  8440. return null;
  8441. }
  8442. const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", {
  8443. className: "editor-post-publish-panel__link",
  8444. key: "label"
  8445. }, (0,external_wp_i18n_namespaceObject.__)('Assign a category'))];
  8446. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  8447. initialOpen: false,
  8448. title: panelBodyTitle
  8449. }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.')), (0,external_wp_element_namespaceObject.createElement)(hierarchical_term_selector, {
  8450. slug: "category"
  8451. }));
  8452. }
  8453. /* harmony default export */ var maybe_category_panel = (MaybeCategoryPanel);
  8454. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js
  8455. /**
  8456. * External dependencies
  8457. */
  8458. /**
  8459. * WordPress dependencies
  8460. */
  8461. /**
  8462. * Internal dependencies
  8463. */
  8464. function PostPublishPanelPrepublish(_ref) {
  8465. let {
  8466. children
  8467. } = _ref;
  8468. const {
  8469. isBeingScheduled,
  8470. isRequestingSiteIcon,
  8471. hasPublishAction,
  8472. siteIconUrl,
  8473. siteTitle,
  8474. siteHome
  8475. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  8476. const {
  8477. getCurrentPost,
  8478. isEditedPostBeingScheduled
  8479. } = select(store_store);
  8480. const {
  8481. getEntityRecord,
  8482. isResolving
  8483. } = select(external_wp_coreData_namespaceObject.store);
  8484. const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
  8485. return {
  8486. hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  8487. isBeingScheduled: isEditedPostBeingScheduled(),
  8488. isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]),
  8489. siteIconUrl: siteData.site_icon_url,
  8490. siteTitle: siteData.name,
  8491. siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home)
  8492. };
  8493. }, []);
  8494. let siteIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  8495. className: "components-site-icon",
  8496. size: "36px",
  8497. icon: library_wordpress
  8498. });
  8499. if (siteIconUrl) {
  8500. siteIcon = (0,external_wp_element_namespaceObject.createElement)("img", {
  8501. alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
  8502. className: "components-site-icon",
  8503. src: siteIconUrl
  8504. });
  8505. }
  8506. if (isRequestingSiteIcon) {
  8507. siteIcon = null;
  8508. }
  8509. let prePublishTitle, prePublishBodyText;
  8510. if (!hasPublishAction) {
  8511. prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to submit for review?');
  8512. prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.');
  8513. } else if (isBeingScheduled) {
  8514. prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to schedule?');
  8515. prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Your work will be published at the specified date and time.');
  8516. } else {
  8517. prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to publish?');
  8518. prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Double-check your settings before publishing.');
  8519. }
  8520. return (0,external_wp_element_namespaceObject.createElement)("div", {
  8521. className: "editor-post-publish-panel__prepublish"
  8522. }, (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)("strong", null, prePublishTitle)), (0,external_wp_element_namespaceObject.createElement)("p", null, prePublishBodyText), (0,external_wp_element_namespaceObject.createElement)("div", {
  8523. className: "components-site-card"
  8524. }, siteIcon, (0,external_wp_element_namespaceObject.createElement)("div", {
  8525. className: "components-site-info"
  8526. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  8527. className: "components-site-name"
  8528. }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)('(Untitled)')), (0,external_wp_element_namespaceObject.createElement)("span", {
  8529. className: "components-site-home"
  8530. }, siteHome))), hasPublishAction && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  8531. initialOpen: false,
  8532. title: [(0,external_wp_i18n_namespaceObject.__)('Visibility:'), (0,external_wp_element_namespaceObject.createElement)("span", {
  8533. className: "editor-post-publish-panel__link",
  8534. key: "label"
  8535. }, (0,external_wp_element_namespaceObject.createElement)(PostVisibilityLabel, null))]
  8536. }, (0,external_wp_element_namespaceObject.createElement)(PostVisibility, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  8537. initialOpen: false,
  8538. title: [(0,external_wp_i18n_namespaceObject.__)('Publish:'), (0,external_wp_element_namespaceObject.createElement)("span", {
  8539. className: "editor-post-publish-panel__link",
  8540. key: "label"
  8541. }, (0,external_wp_element_namespaceObject.createElement)(PostScheduleLabel, null))]
  8542. }, (0,external_wp_element_namespaceObject.createElement)(PostSchedule, null))), (0,external_wp_element_namespaceObject.createElement)(PostFormatPanel, null), (0,external_wp_element_namespaceObject.createElement)(maybe_tags_panel, null), (0,external_wp_element_namespaceObject.createElement)(maybe_category_panel, null), children);
  8543. }
  8544. /* harmony default export */ var prepublish = (PostPublishPanelPrepublish);
  8545. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js
  8546. /**
  8547. * External dependencies
  8548. */
  8549. /**
  8550. * WordPress dependencies
  8551. */
  8552. /**
  8553. * Internal dependencies
  8554. */
  8555. const POSTNAME = '%postname%';
  8556. /**
  8557. * Returns URL for a future post.
  8558. *
  8559. * @param {Object} post Post object.
  8560. *
  8561. * @return {string} PostPublish URL.
  8562. */
  8563. const getFuturePostUrl = post => {
  8564. const {
  8565. slug
  8566. } = post;
  8567. if (post.permalink_template.includes(POSTNAME)) {
  8568. return post.permalink_template.replace(POSTNAME, slug);
  8569. }
  8570. return post.permalink_template;
  8571. };
  8572. function postpublish_CopyButton(_ref) {
  8573. let {
  8574. text,
  8575. onCopy,
  8576. children
  8577. } = _ref;
  8578. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, onCopy);
  8579. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  8580. variant: "secondary",
  8581. ref: ref
  8582. }, children);
  8583. }
  8584. class PostPublishPanelPostpublish extends external_wp_element_namespaceObject.Component {
  8585. constructor() {
  8586. super(...arguments);
  8587. this.state = {
  8588. showCopyConfirmation: false
  8589. };
  8590. this.onCopy = this.onCopy.bind(this);
  8591. this.onSelectInput = this.onSelectInput.bind(this);
  8592. this.postLink = (0,external_wp_element_namespaceObject.createRef)();
  8593. }
  8594. componentDidMount() {
  8595. if (this.props.focusOnMount) {
  8596. this.postLink.current.focus();
  8597. }
  8598. }
  8599. componentWillUnmount() {
  8600. clearTimeout(this.dismissCopyConfirmation);
  8601. }
  8602. onCopy() {
  8603. this.setState({
  8604. showCopyConfirmation: true
  8605. });
  8606. clearTimeout(this.dismissCopyConfirmation);
  8607. this.dismissCopyConfirmation = setTimeout(() => {
  8608. this.setState({
  8609. showCopyConfirmation: false
  8610. });
  8611. }, 4000);
  8612. }
  8613. onSelectInput(event) {
  8614. event.target.select();
  8615. }
  8616. render() {
  8617. const {
  8618. children,
  8619. isScheduled,
  8620. post,
  8621. postType
  8622. } = this.props;
  8623. const postLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'singular_name']);
  8624. const viewPostLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_item']);
  8625. const addNewPostLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'add_new_item']);
  8626. const link = post.status === 'future' ? getFuturePostUrl(post) : post.link;
  8627. const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', {
  8628. post_type: post.type
  8629. });
  8630. const postPublishNonLinkHeader = isScheduled ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('is now scheduled. It will go live on'), ' ', (0,external_wp_element_namespaceObject.createElement)(PostScheduleLabel, null), ".") : (0,external_wp_i18n_namespaceObject.__)('is now live.');
  8631. return (0,external_wp_element_namespaceObject.createElement)("div", {
  8632. className: "post-publish-panel__postpublish"
  8633. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  8634. className: "post-publish-panel__postpublish-header"
  8635. }, (0,external_wp_element_namespaceObject.createElement)("a", {
  8636. ref: this.postLink,
  8637. href: link
  8638. }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)('(no title)')), ' ', postPublishNonLinkHeader), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)("p", {
  8639. className: "post-publish-panel__postpublish-subheader"
  8640. }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('What’s next?'))), (0,external_wp_element_namespaceObject.createElement)("div", {
  8641. className: "post-publish-panel__postpublish-post-address-container"
  8642. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  8643. className: "post-publish-panel__postpublish-post-address",
  8644. readOnly: true,
  8645. label: (0,external_wp_i18n_namespaceObject.sprintf)(
  8646. /* translators: %s: post type singular name */
  8647. (0,external_wp_i18n_namespaceObject.__)('%s address'), postLabel),
  8648. value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link),
  8649. onFocus: this.onSelectInput
  8650. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  8651. className: "post-publish-panel__postpublish-post-address__copy-button-wrap"
  8652. }, (0,external_wp_element_namespaceObject.createElement)(postpublish_CopyButton, {
  8653. text: link,
  8654. onCopy: this.onCopy
  8655. }, this.state.showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy')))), (0,external_wp_element_namespaceObject.createElement)("div", {
  8656. className: "post-publish-panel__postpublish-buttons"
  8657. }, !isScheduled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  8658. variant: "primary",
  8659. href: link
  8660. }, viewPostLabel), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  8661. variant: isScheduled ? 'primary' : 'secondary',
  8662. href: addLink
  8663. }, addNewPostLabel))), children);
  8664. }
  8665. }
  8666. /* harmony default export */ var postpublish = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  8667. const {
  8668. getEditedPostAttribute,
  8669. getCurrentPost,
  8670. isCurrentPostScheduled
  8671. } = select(store_store);
  8672. const {
  8673. getPostType
  8674. } = select(external_wp_coreData_namespaceObject.store);
  8675. return {
  8676. post: getCurrentPost(),
  8677. postType: getPostType(getEditedPostAttribute('type')),
  8678. isScheduled: isCurrentPostScheduled()
  8679. };
  8680. })(PostPublishPanelPostpublish));
  8681. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js
  8682. /**
  8683. * External dependencies
  8684. */
  8685. /**
  8686. * WordPress dependencies
  8687. */
  8688. /**
  8689. * Internal dependencies
  8690. */
  8691. class PostPublishPanel extends external_wp_element_namespaceObject.Component {
  8692. constructor() {
  8693. super(...arguments);
  8694. this.onSubmit = this.onSubmit.bind(this);
  8695. }
  8696. componentDidUpdate(prevProps) {
  8697. // Automatically collapse the publish sidebar when a post
  8698. // is published and the user makes an edit.
  8699. if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty) {
  8700. this.props.onClose();
  8701. }
  8702. }
  8703. onSubmit() {
  8704. const {
  8705. onClose,
  8706. hasPublishAction,
  8707. isPostTypeViewable
  8708. } = this.props;
  8709. if (!hasPublishAction || !isPostTypeViewable) {
  8710. onClose();
  8711. }
  8712. }
  8713. render() {
  8714. const {
  8715. forceIsDirty,
  8716. forceIsSaving,
  8717. isBeingScheduled,
  8718. isPublished,
  8719. isPublishSidebarEnabled,
  8720. isScheduled,
  8721. isSaving,
  8722. isSavingNonPostEntityChanges,
  8723. onClose,
  8724. onTogglePublishSidebar,
  8725. PostPublishExtension,
  8726. PrePublishExtension,
  8727. ...additionalProps
  8728. } = this.props;
  8729. const {
  8730. hasPublishAction,
  8731. isDirty,
  8732. isPostTypeViewable,
  8733. ...propsForPanel
  8734. } = additionalProps;
  8735. const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled;
  8736. const isPrePublish = !isPublishedOrScheduled && !isSaving;
  8737. const isPostPublish = isPublishedOrScheduled && !isSaving;
  8738. return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
  8739. className: "editor-post-publish-panel"
  8740. }, propsForPanel), (0,external_wp_element_namespaceObject.createElement)("div", {
  8741. className: "editor-post-publish-panel__header"
  8742. }, isPostPublish ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  8743. onClick: onClose,
  8744. icon: close_small,
  8745. label: (0,external_wp_i18n_namespaceObject.__)('Close panel')
  8746. }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  8747. className: "editor-post-publish-panel__header-publish-button"
  8748. }, (0,external_wp_element_namespaceObject.createElement)(post_publish_button, {
  8749. focusOnMount: true,
  8750. onSubmit: this.onSubmit,
  8751. forceIsDirty: forceIsDirty,
  8752. forceIsSaving: forceIsSaving
  8753. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  8754. className: "editor-post-publish-panel__header-cancel-button"
  8755. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  8756. disabled: isSavingNonPostEntityChanges,
  8757. onClick: onClose,
  8758. variant: "secondary"
  8759. }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))))), (0,external_wp_element_namespaceObject.createElement)("div", {
  8760. className: "editor-post-publish-panel__content"
  8761. }, isPrePublish && (0,external_wp_element_namespaceObject.createElement)(prepublish, null, PrePublishExtension && (0,external_wp_element_namespaceObject.createElement)(PrePublishExtension, null)), isPostPublish && (0,external_wp_element_namespaceObject.createElement)(postpublish, {
  8762. focusOnMount: true
  8763. }, PostPublishExtension && (0,external_wp_element_namespaceObject.createElement)(PostPublishExtension, null)), isSaving && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), (0,external_wp_element_namespaceObject.createElement)("div", {
  8764. className: "editor-post-publish-panel__footer"
  8765. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  8766. label: (0,external_wp_i18n_namespaceObject.__)('Always show pre-publish checks.'),
  8767. checked: isPublishSidebarEnabled,
  8768. onChange: onTogglePublishSidebar
  8769. })));
  8770. }
  8771. }
  8772. /* harmony default export */ var post_publish_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  8773. const {
  8774. getPostType
  8775. } = select(external_wp_coreData_namespaceObject.store);
  8776. const {
  8777. getCurrentPost,
  8778. getEditedPostAttribute,
  8779. isCurrentPostPublished,
  8780. isCurrentPostScheduled,
  8781. isEditedPostBeingScheduled,
  8782. isEditedPostDirty,
  8783. isSavingPost,
  8784. isSavingNonPostEntityChanges
  8785. } = select(store_store);
  8786. const {
  8787. isPublishSidebarEnabled
  8788. } = select(store_store);
  8789. const postType = getPostType(getEditedPostAttribute('type'));
  8790. return {
  8791. hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  8792. isPostTypeViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false),
  8793. isBeingScheduled: isEditedPostBeingScheduled(),
  8794. isDirty: isEditedPostDirty(),
  8795. isPublished: isCurrentPostPublished(),
  8796. isPublishSidebarEnabled: isPublishSidebarEnabled(),
  8797. isSaving: isSavingPost(),
  8798. isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
  8799. isScheduled: isCurrentPostScheduled()
  8800. };
  8801. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref) => {
  8802. let {
  8803. isPublishSidebarEnabled
  8804. } = _ref;
  8805. const {
  8806. disablePublishSidebar,
  8807. enablePublishSidebar
  8808. } = dispatch(store_store);
  8809. return {
  8810. onTogglePublishSidebar: () => {
  8811. if (isPublishSidebarEnabled) {
  8812. disablePublishSidebar();
  8813. } else {
  8814. enablePublishSidebar();
  8815. }
  8816. }
  8817. };
  8818. }), external_wp_components_namespaceObject.withFocusReturn, external_wp_components_namespaceObject.withConstrainedTabbing])(PostPublishPanel));
  8819. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js
  8820. /**
  8821. * WordPress dependencies
  8822. */
  8823. const cloudUpload = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  8824. xmlns: "http://www.w3.org/2000/svg",
  8825. viewBox: "0 0 24 24"
  8826. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  8827. d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z"
  8828. }));
  8829. /* harmony default export */ var cloud_upload = (cloudUpload);
  8830. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
  8831. /**
  8832. * WordPress dependencies
  8833. */
  8834. /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
  8835. /**
  8836. * Return an SVG icon.
  8837. *
  8838. * @param {IconProps} props icon is the SVG component to render
  8839. * size is a number specifiying the icon size in pixels
  8840. * Other props will be passed to wrapped SVG component
  8841. *
  8842. * @return {JSX.Element} Icon component
  8843. */
  8844. function Icon(_ref) {
  8845. let {
  8846. icon,
  8847. size = 24,
  8848. ...props
  8849. } = _ref;
  8850. return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  8851. width: size,
  8852. height: size,
  8853. ...props
  8854. });
  8855. }
  8856. /* harmony default export */ var icon = (Icon);
  8857. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
  8858. /**
  8859. * WordPress dependencies
  8860. */
  8861. const check_check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  8862. xmlns: "http://www.w3.org/2000/svg",
  8863. viewBox: "0 0 24 24"
  8864. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  8865. d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
  8866. }));
  8867. /* harmony default export */ var library_check = (check_check);
  8868. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js
  8869. /**
  8870. * WordPress dependencies
  8871. */
  8872. const cloud = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  8873. xmlns: "http://www.w3.org/2000/svg",
  8874. viewBox: "0 0 24 24"
  8875. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  8876. d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"
  8877. }));
  8878. /* harmony default export */ var library_cloud = (cloud);
  8879. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js
  8880. /**
  8881. * WordPress dependencies
  8882. */
  8883. /**
  8884. * Internal dependencies
  8885. */
  8886. function PostSwitchToDraftButton(_ref) {
  8887. let {
  8888. isSaving,
  8889. isPublished,
  8890. isScheduled,
  8891. onClick
  8892. } = _ref;
  8893. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<');
  8894. const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false);
  8895. if (!isPublished && !isScheduled) {
  8896. return null;
  8897. }
  8898. let alertMessage;
  8899. if (isPublished) {
  8900. alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unpublish this post?');
  8901. } else if (isScheduled) {
  8902. alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unschedule this post?');
  8903. }
  8904. const handleConfirm = () => {
  8905. setShowConfirmDialog(false);
  8906. onClick();
  8907. };
  8908. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  8909. className: "editor-post-switch-to-draft",
  8910. onClick: () => {
  8911. setShowConfirmDialog(true);
  8912. },
  8913. disabled: isSaving,
  8914. variant: "tertiary"
  8915. }, isMobileViewport ? (0,external_wp_i18n_namespaceObject.__)('Draft') : (0,external_wp_i18n_namespaceObject.__)('Switch to draft')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
  8916. isOpen: showConfirmDialog,
  8917. onConfirm: handleConfirm,
  8918. onCancel: () => setShowConfirmDialog(false)
  8919. }, alertMessage));
  8920. }
  8921. /* harmony default export */ var post_switch_to_draft_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  8922. const {
  8923. isSavingPost,
  8924. isCurrentPostPublished,
  8925. isCurrentPostScheduled
  8926. } = select(store_store);
  8927. return {
  8928. isSaving: isSavingPost(),
  8929. isPublished: isCurrentPostPublished(),
  8930. isScheduled: isCurrentPostScheduled()
  8931. };
  8932. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  8933. const {
  8934. editPost,
  8935. savePost
  8936. } = dispatch(store_store);
  8937. return {
  8938. onClick: () => {
  8939. editPost({
  8940. status: 'draft'
  8941. });
  8942. savePost();
  8943. }
  8944. };
  8945. })])(PostSwitchToDraftButton));
  8946. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js
  8947. /**
  8948. * External dependencies
  8949. */
  8950. /**
  8951. * WordPress dependencies
  8952. */
  8953. /**
  8954. * Internal dependencies
  8955. */
  8956. /**
  8957. * Component showing whether the post is saved or not and providing save
  8958. * buttons.
  8959. *
  8960. * @param {Object} props Component props.
  8961. * @param {?boolean} props.forceIsDirty Whether to force the post to be marked
  8962. * as dirty.
  8963. * @param {?boolean} props.forceIsSaving Whether to force the post to be marked
  8964. * as being saved.
  8965. * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons
  8966. * @return {import('@wordpress/element').WPComponent} The component.
  8967. */
  8968. function PostSavedState(_ref) {
  8969. let {
  8970. forceIsDirty,
  8971. forceIsSaving,
  8972. showIconLabels = false
  8973. } = _ref;
  8974. const [forceSavedMessage, setForceSavedMessage] = (0,external_wp_element_namespaceObject.useState)(false);
  8975. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small');
  8976. const {
  8977. isAutosaving,
  8978. isDirty,
  8979. isNew,
  8980. isPending,
  8981. isPublished,
  8982. isSaveable,
  8983. isSaving,
  8984. isScheduled,
  8985. hasPublishAction
  8986. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  8987. var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2;
  8988. const {
  8989. isEditedPostNew,
  8990. isCurrentPostPublished,
  8991. isCurrentPostScheduled,
  8992. isEditedPostDirty,
  8993. isSavingPost,
  8994. isEditedPostSaveable,
  8995. getCurrentPost,
  8996. isAutosavingPost,
  8997. getEditedPostAttribute
  8998. } = select(store_store);
  8999. return {
  9000. isAutosaving: isAutosavingPost(),
  9001. isDirty: forceIsDirty || isEditedPostDirty(),
  9002. isNew: isEditedPostNew(),
  9003. isPending: 'pending' === getEditedPostAttribute('status'),
  9004. isPublished: isCurrentPostPublished(),
  9005. isSaving: forceIsSaving || isSavingPost(),
  9006. isSaveable: isEditedPostSaveable(),
  9007. isScheduled: isCurrentPostScheduled(),
  9008. hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost = getCurrentPost()) === null || _getCurrentPost === void 0 ? void 0 : (_getCurrentPost$_link2 = _getCurrentPost._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false
  9009. };
  9010. }, [forceIsDirty, forceIsSaving]);
  9011. const {
  9012. savePost
  9013. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  9014. const wasSaving = (0,external_wp_compose_namespaceObject.usePrevious)(isSaving);
  9015. (0,external_wp_element_namespaceObject.useEffect)(() => {
  9016. let timeoutId;
  9017. if (wasSaving && !isSaving) {
  9018. setForceSavedMessage(true);
  9019. timeoutId = setTimeout(() => {
  9020. setForceSavedMessage(false);
  9021. }, 1000);
  9022. }
  9023. return () => clearTimeout(timeoutId);
  9024. }, [isSaving]); // Once the post has been submitted for review this button
  9025. // is not needed for the contributor role.
  9026. if (!hasPublishAction && isPending) {
  9027. return null;
  9028. }
  9029. if (isPublished || isScheduled) {
  9030. return (0,external_wp_element_namespaceObject.createElement)(post_switch_to_draft_button, null);
  9031. }
  9032. /* translators: button label text should, if possible, be under 16 characters. */
  9033. const label = isPending ? (0,external_wp_i18n_namespaceObject.__)('Save as pending') : (0,external_wp_i18n_namespaceObject.__)('Save draft');
  9034. /* translators: button label text should, if possible, be under 16 characters. */
  9035. const shortLabel = (0,external_wp_i18n_namespaceObject.__)('Save');
  9036. const isSaved = forceSavedMessage || !isNew && !isDirty;
  9037. const isSavedState = isSaving || isSaved;
  9038. const isDisabled = isSaving || isSaved || !isSaveable;
  9039. let text;
  9040. if (isSaving) {
  9041. text = isAutosaving ? (0,external_wp_i18n_namespaceObject.__)('Autosaving') : (0,external_wp_i18n_namespaceObject.__)('Saving');
  9042. } else if (isSaved) {
  9043. text = (0,external_wp_i18n_namespaceObject.__)('Saved');
  9044. } else if (isLargeViewport) {
  9045. text = label;
  9046. } else if (showIconLabels) {
  9047. text = shortLabel;
  9048. } // Use common Button instance for all saved states so that focus is not
  9049. // lost.
  9050. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  9051. className: isSaveable || isSaving ? classnames_default()({
  9052. 'editor-post-save-draft': !isSavedState,
  9053. 'editor-post-saved-state': isSavedState,
  9054. 'is-saving': isSaving,
  9055. 'is-autosaving': isAutosaving,
  9056. 'is-saved': isSaved,
  9057. [(0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({
  9058. type: 'loading'
  9059. })]: isSaving
  9060. }) : undefined,
  9061. onClick: isDisabled ? undefined : () => savePost(),
  9062. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('s'),
  9063. variant: isLargeViewport ? 'tertiary' : undefined,
  9064. icon: isLargeViewport ? undefined : cloud_upload,
  9065. label: showIconLabels ? undefined : label,
  9066. "aria-disabled": isDisabled
  9067. }, isSavedState && (0,external_wp_element_namespaceObject.createElement)(icon, {
  9068. icon: isSaved ? library_check : library_cloud
  9069. }), text);
  9070. }
  9071. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js
  9072. /**
  9073. * External dependencies
  9074. */
  9075. /**
  9076. * WordPress dependencies
  9077. */
  9078. /**
  9079. * Internal dependencies
  9080. */
  9081. function PostScheduleCheck(_ref) {
  9082. let {
  9083. hasPublishAction,
  9084. children
  9085. } = _ref;
  9086. if (!hasPublishAction) {
  9087. return null;
  9088. }
  9089. return children;
  9090. }
  9091. /* harmony default export */ var post_schedule_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  9092. const {
  9093. getCurrentPost,
  9094. getCurrentPostType
  9095. } = select(store_store);
  9096. return {
  9097. hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  9098. postType: getCurrentPostType()
  9099. };
  9100. })])(PostScheduleCheck));
  9101. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js
  9102. /**
  9103. * Internal dependencies
  9104. */
  9105. function PostSlugCheck(_ref) {
  9106. let {
  9107. children
  9108. } = _ref;
  9109. return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
  9110. supportKeys: "slug"
  9111. }, children);
  9112. }
  9113. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js
  9114. /**
  9115. * WordPress dependencies
  9116. */
  9117. /**
  9118. * Internal dependencies
  9119. */
  9120. class PostSlug extends external_wp_element_namespaceObject.Component {
  9121. constructor(_ref) {
  9122. let {
  9123. postSlug,
  9124. postTitle,
  9125. postID
  9126. } = _ref;
  9127. super(...arguments);
  9128. this.state = {
  9129. editedSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postSlug) || (0,external_wp_url_namespaceObject.cleanForSlug)(postTitle) || postID
  9130. };
  9131. this.setSlug = this.setSlug.bind(this);
  9132. }
  9133. setSlug(event) {
  9134. const {
  9135. postSlug,
  9136. onUpdateSlug
  9137. } = this.props;
  9138. const {
  9139. value
  9140. } = event.target;
  9141. const editedSlug = (0,external_wp_url_namespaceObject.cleanForSlug)(value);
  9142. if (editedSlug === postSlug) {
  9143. return;
  9144. }
  9145. onUpdateSlug(editedSlug);
  9146. }
  9147. render() {
  9148. const {
  9149. editedSlug
  9150. } = this.state;
  9151. return (0,external_wp_element_namespaceObject.createElement)(PostSlugCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  9152. label: (0,external_wp_i18n_namespaceObject.__)('Slug'),
  9153. autoComplete: "off",
  9154. spellCheck: "false",
  9155. value: editedSlug,
  9156. onChange: slug => this.setState({
  9157. editedSlug: slug
  9158. }),
  9159. onBlur: this.setSlug,
  9160. className: "editor-post-slug"
  9161. }));
  9162. }
  9163. }
  9164. /* harmony default export */ var post_slug = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  9165. const {
  9166. getCurrentPost,
  9167. getEditedPostAttribute
  9168. } = select(store_store);
  9169. const {
  9170. id
  9171. } = getCurrentPost();
  9172. return {
  9173. postSlug: getEditedPostAttribute('slug'),
  9174. postTitle: getEditedPostAttribute('title'),
  9175. postID: id
  9176. };
  9177. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  9178. const {
  9179. editPost
  9180. } = dispatch(store_store);
  9181. return {
  9182. onUpdateSlug(slug) {
  9183. editPost({
  9184. slug
  9185. });
  9186. }
  9187. };
  9188. })])(PostSlug));
  9189. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js
  9190. /**
  9191. * External dependencies
  9192. */
  9193. /**
  9194. * WordPress dependencies
  9195. */
  9196. /**
  9197. * Internal dependencies
  9198. */
  9199. function PostStickyCheck(_ref) {
  9200. let {
  9201. hasStickyAction,
  9202. postType,
  9203. children
  9204. } = _ref;
  9205. if (postType !== 'post' || !hasStickyAction) {
  9206. return null;
  9207. }
  9208. return children;
  9209. }
  9210. /* harmony default export */ var post_sticky_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  9211. const post = select(store_store).getCurrentPost();
  9212. return {
  9213. hasStickyAction: (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-sticky'], false),
  9214. postType: select(store_store).getCurrentPostType()
  9215. };
  9216. })])(PostStickyCheck));
  9217. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js
  9218. /**
  9219. * WordPress dependencies
  9220. */
  9221. /**
  9222. * Internal dependencies
  9223. */
  9224. function PostSticky(_ref) {
  9225. let {
  9226. onUpdateSticky,
  9227. postSticky = false
  9228. } = _ref;
  9229. return (0,external_wp_element_namespaceObject.createElement)(post_sticky_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  9230. label: (0,external_wp_i18n_namespaceObject.__)('Stick to the top of the blog'),
  9231. checked: postSticky,
  9232. onChange: () => onUpdateSticky(!postSticky)
  9233. }));
  9234. }
  9235. /* harmony default export */ var post_sticky = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  9236. return {
  9237. postSticky: select(store_store).getEditedPostAttribute('sticky')
  9238. };
  9239. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  9240. return {
  9241. onUpdateSticky(postSticky) {
  9242. dispatch(store_store).editPost({
  9243. sticky: postSticky
  9244. });
  9245. }
  9246. };
  9247. })])(PostSticky));
  9248. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js
  9249. /**
  9250. * External dependencies
  9251. */
  9252. /**
  9253. * WordPress dependencies
  9254. */
  9255. /**
  9256. * Internal dependencies
  9257. */
  9258. const identity = x => x;
  9259. function PostTaxonomies(_ref) {
  9260. let {
  9261. postType,
  9262. taxonomies,
  9263. taxonomyWrapper = identity
  9264. } = _ref;
  9265. const availableTaxonomies = (0,external_lodash_namespaceObject.filter)(taxonomies, taxonomy => (0,external_lodash_namespaceObject.includes)(taxonomy.types, postType));
  9266. const visibleTaxonomies = (0,external_lodash_namespaceObject.filter)(availableTaxonomies, // In some circumstances .visibility can end up as undefined so optional chaining operator required.
  9267. // https://github.com/WordPress/gutenberg/issues/40326
  9268. taxonomy => {
  9269. var _taxonomy$visibility;
  9270. return (_taxonomy$visibility = taxonomy.visibility) === null || _taxonomy$visibility === void 0 ? void 0 : _taxonomy$visibility.show_ui;
  9271. });
  9272. return visibleTaxonomies.map(taxonomy => {
  9273. const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector;
  9274. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
  9275. key: `taxonomy-${taxonomy.slug}`
  9276. }, taxonomyWrapper((0,external_wp_element_namespaceObject.createElement)(TaxonomyComponent, {
  9277. slug: taxonomy.slug
  9278. }), taxonomy));
  9279. });
  9280. }
  9281. /* harmony default export */ var post_taxonomies = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  9282. return {
  9283. postType: select(store_store).getCurrentPostType(),
  9284. taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({
  9285. per_page: -1
  9286. })
  9287. };
  9288. })])(PostTaxonomies));
  9289. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js
  9290. /**
  9291. * External dependencies
  9292. */
  9293. /**
  9294. * WordPress dependencies
  9295. */
  9296. /**
  9297. * Internal dependencies
  9298. */
  9299. function PostTaxonomiesCheck(_ref) {
  9300. let {
  9301. postType,
  9302. taxonomies,
  9303. children
  9304. } = _ref;
  9305. const hasTaxonomies = (0,external_lodash_namespaceObject.some)(taxonomies, taxonomy => (0,external_lodash_namespaceObject.includes)(taxonomy.types, postType));
  9306. if (!hasTaxonomies) {
  9307. return null;
  9308. }
  9309. return children;
  9310. }
  9311. /* harmony default export */ var post_taxonomies_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  9312. return {
  9313. postType: select(store_store).getCurrentPostType(),
  9314. taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({
  9315. per_page: -1
  9316. })
  9317. };
  9318. })])(PostTaxonomiesCheck));
  9319. // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
  9320. var lib = __webpack_require__(773);
  9321. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js
  9322. /**
  9323. * External dependencies
  9324. */
  9325. /**
  9326. * WordPress dependencies
  9327. */
  9328. /**
  9329. * Internal dependencies
  9330. */
  9331. function PostTextEditor() {
  9332. const postContent = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostContent(), []);
  9333. const {
  9334. editPost,
  9335. resetEditorBlocks
  9336. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  9337. const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(postContent);
  9338. const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(false);
  9339. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor);
  9340. const valueRef = (0,external_wp_element_namespaceObject.useRef)();
  9341. if (!isDirty && value !== postContent) {
  9342. setValue(postContent);
  9343. }
  9344. /**
  9345. * Handles a textarea change event to notify the onChange prop callback and
  9346. * reflect the new value in the component's own state. This marks the start
  9347. * of the user's edits, if not already changed, preventing future props
  9348. * changes to value from replacing the rendered value. This is expected to
  9349. * be followed by a reset to dirty state via `stopEditing`.
  9350. *
  9351. * @see stopEditing
  9352. *
  9353. * @param {Event} event Change event.
  9354. */
  9355. const onChange = event => {
  9356. const newValue = event.target.value;
  9357. editPost({
  9358. content: newValue
  9359. });
  9360. setValue(newValue);
  9361. setIsDirty(true);
  9362. valueRef.current = newValue;
  9363. };
  9364. /**
  9365. * Function called when the user has completed their edits, responsible for
  9366. * ensuring that changes, if made, are surfaced to the onPersist prop
  9367. * callback and resetting dirty state.
  9368. */
  9369. const stopEditing = () => {
  9370. if (isDirty) {
  9371. const blocks = (0,external_wp_blocks_namespaceObject.parse)(value);
  9372. resetEditorBlocks(blocks);
  9373. setIsDirty(false);
  9374. }
  9375. }; // Ensure changes aren't lost when component unmounts.
  9376. (0,external_wp_element_namespaceObject.useEffect)(() => {
  9377. return () => {
  9378. if (valueRef.current) {
  9379. const blocks = (0,external_wp_blocks_namespaceObject.parse)(valueRef.current);
  9380. resetEditorBlocks(blocks);
  9381. }
  9382. };
  9383. }, []);
  9384. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  9385. as: "label",
  9386. htmlFor: `post-content-${instanceId}`
  9387. }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, {
  9388. autoComplete: "off",
  9389. dir: "auto",
  9390. value: value,
  9391. onChange: onChange,
  9392. onBlur: stopEditing,
  9393. className: "editor-post-text-editor",
  9394. id: `post-content-${instanceId}`,
  9395. placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML')
  9396. }));
  9397. }
  9398. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js
  9399. /**
  9400. * External dependencies
  9401. */
  9402. /**
  9403. * WordPress dependencies
  9404. */
  9405. /**
  9406. * Internal dependencies
  9407. */
  9408. /**
  9409. * Constants
  9410. */
  9411. const REGEXP_NEWLINES = /[\r\n]+/g;
  9412. function PostTitle(_, forwardedRef) {
  9413. const ref = (0,external_wp_element_namespaceObject.useRef)();
  9414. const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false);
  9415. const {
  9416. editPost
  9417. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  9418. const {
  9419. insertDefaultBlock,
  9420. clearSelectedBlock,
  9421. insertBlocks
  9422. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  9423. const {
  9424. isCleanNewPost,
  9425. title,
  9426. placeholder,
  9427. isFocusMode,
  9428. hasFixedToolbar
  9429. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  9430. const {
  9431. getEditedPostAttribute,
  9432. isCleanNewPost: _isCleanNewPost
  9433. } = select(store_store);
  9434. const {
  9435. getSettings
  9436. } = select(external_wp_blockEditor_namespaceObject.store);
  9437. const {
  9438. titlePlaceholder,
  9439. focusMode,
  9440. hasFixedToolbar: _hasFixedToolbar
  9441. } = getSettings();
  9442. return {
  9443. isCleanNewPost: _isCleanNewPost(),
  9444. title: getEditedPostAttribute('title'),
  9445. placeholder: titlePlaceholder,
  9446. isFocusMode: focusMode,
  9447. hasFixedToolbar: _hasFixedToolbar
  9448. };
  9449. }, []);
  9450. (0,external_wp_element_namespaceObject.useImperativeHandle)(forwardedRef, () => ({
  9451. focus: () => {
  9452. var _ref$current;
  9453. ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
  9454. }
  9455. }));
  9456. (0,external_wp_element_namespaceObject.useEffect)(() => {
  9457. if (!ref.current) {
  9458. return;
  9459. }
  9460. const {
  9461. ownerDocument
  9462. } = ref.current;
  9463. const {
  9464. activeElement,
  9465. body
  9466. } = ownerDocument; // Only autofocus the title when the post is entirely empty. This should
  9467. // only happen for a new post, which means we focus the title on new
  9468. // post so the author can start typing right away, without needing to
  9469. // click anything.
  9470. if (isCleanNewPost && (!activeElement || body === activeElement)) {
  9471. ref.current.focus();
  9472. }
  9473. }, [isCleanNewPost]);
  9474. function onEnterPress() {
  9475. insertDefaultBlock(undefined, undefined, 0);
  9476. }
  9477. function onInsertBlockAfter(blocks) {
  9478. insertBlocks(blocks, 0);
  9479. }
  9480. function onUpdate(newTitle) {
  9481. editPost({
  9482. title: newTitle
  9483. });
  9484. }
  9485. const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)({});
  9486. function onSelect() {
  9487. setIsSelected(true);
  9488. clearSelectedBlock();
  9489. }
  9490. function onUnselect() {
  9491. setIsSelected(false);
  9492. setSelection({});
  9493. }
  9494. function onChange(value) {
  9495. onUpdate(value.replace(REGEXP_NEWLINES, ' '));
  9496. }
  9497. function onKeyDown(event) {
  9498. if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
  9499. event.preventDefault();
  9500. onEnterPress();
  9501. }
  9502. }
  9503. function onPaste(event) {
  9504. const clipboardData = event.clipboardData;
  9505. let plainText = '';
  9506. let html = ''; // IE11 only supports `Text` as an argument for `getData` and will
  9507. // otherwise throw an invalid argument error, so we try the standard
  9508. // arguments first, then fallback to `Text` if they fail.
  9509. try {
  9510. plainText = clipboardData.getData('text/plain');
  9511. html = clipboardData.getData('text/html');
  9512. } catch (error1) {
  9513. try {
  9514. html = clipboardData.getData('Text');
  9515. } catch (error2) {
  9516. // Some browsers like UC Browser paste plain text by default and
  9517. // don't support clipboardData at all, so allow default
  9518. // behaviour.
  9519. return;
  9520. }
  9521. } // Allows us to ask for this information when we get a report.
  9522. window.console.log('Received HTML:\n\n', html);
  9523. window.console.log('Received plain text:\n\n', plainText);
  9524. const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({
  9525. HTML: html,
  9526. plainText
  9527. });
  9528. event.preventDefault();
  9529. if (!content.length) {
  9530. return;
  9531. }
  9532. if (typeof content !== 'string') {
  9533. const [firstBlock] = content;
  9534. if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) {
  9535. onUpdate(firstBlock.attributes.content);
  9536. onInsertBlockAfter(content.slice(1));
  9537. } else {
  9538. onInsertBlockAfter(content);
  9539. }
  9540. } else {
  9541. const value = { ...(0,external_wp_richText_namespaceObject.create)({
  9542. html: title
  9543. }),
  9544. ...selection
  9545. };
  9546. const newValue = (0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({
  9547. html: content
  9548. }));
  9549. onUpdate((0,external_wp_richText_namespaceObject.toHTMLString)({
  9550. value: newValue
  9551. }));
  9552. setSelection({
  9553. start: newValue.start,
  9554. end: newValue.end
  9555. });
  9556. }
  9557. } // The wp-block className is important for editor styles.
  9558. // This same block is used in both the visual and the code editor.
  9559. const className = classnames_default()('wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text', {
  9560. 'is-selected': isSelected,
  9561. 'is-focus-mode': isFocusMode,
  9562. 'has-fixed-toolbar': hasFixedToolbar
  9563. });
  9564. const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title');
  9565. const {
  9566. ref: richTextRef
  9567. } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({
  9568. value: title,
  9569. onChange,
  9570. placeholder: decodedPlaceholder,
  9571. selectionStart: selection.start,
  9572. selectionEnd: selection.end,
  9573. onSelectionChange(newStart, newEnd) {
  9574. setSelection(sel => {
  9575. const {
  9576. start,
  9577. end
  9578. } = sel;
  9579. if (start === newStart && end === newEnd) {
  9580. return sel;
  9581. }
  9582. return {
  9583. start: newStart,
  9584. end: newEnd
  9585. };
  9586. });
  9587. },
  9588. __unstableDisableFormats: true,
  9589. preserveWhiteSpace: true
  9590. });
  9591. /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
  9592. return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
  9593. supportKeys: "title"
  9594. }, (0,external_wp_element_namespaceObject.createElement)("h1", {
  9595. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, ref]),
  9596. contentEditable: true,
  9597. className: className,
  9598. "aria-label": decodedPlaceholder,
  9599. role: "textbox",
  9600. "aria-multiline": "true",
  9601. onFocus: onSelect,
  9602. onBlur: onUnselect,
  9603. onKeyDown: onKeyDown,
  9604. onKeyPress: onUnselect,
  9605. onPaste: onPaste
  9606. }));
  9607. /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
  9608. }
  9609. /* harmony default export */ var post_title = ((0,external_wp_element_namespaceObject.forwardRef)(PostTitle));
  9610. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js
  9611. /**
  9612. * WordPress dependencies
  9613. */
  9614. /**
  9615. * Internal dependencies
  9616. */
  9617. function PostTrash() {
  9618. const {
  9619. isNew,
  9620. isDeleting,
  9621. postId
  9622. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  9623. const store = select(store_store);
  9624. return {
  9625. isNew: store.isEditedPostNew(),
  9626. isDeleting: store.isDeletingPost(),
  9627. postId: store.getCurrentPostId()
  9628. };
  9629. }, []);
  9630. const {
  9631. trashPost
  9632. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  9633. if (isNew || !postId) {
  9634. return null;
  9635. }
  9636. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  9637. className: "editor-post-trash",
  9638. isDestructive: true,
  9639. variant: "secondary",
  9640. isBusy: isDeleting,
  9641. "aria-disabled": isDeleting,
  9642. onClick: isDeleting ? undefined : () => trashPost()
  9643. }, (0,external_wp_i18n_namespaceObject.__)('Move to trash'));
  9644. }
  9645. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js
  9646. /**
  9647. * WordPress dependencies
  9648. */
  9649. /**
  9650. * Internal dependencies
  9651. */
  9652. function PostTrashCheck(_ref) {
  9653. let {
  9654. isNew,
  9655. postId,
  9656. canUserDelete,
  9657. children
  9658. } = _ref;
  9659. if (isNew || !postId || !canUserDelete) {
  9660. return null;
  9661. }
  9662. return children;
  9663. }
  9664. /* harmony default export */ var post_trash_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  9665. const {
  9666. isEditedPostNew,
  9667. getCurrentPostId,
  9668. getCurrentPostType
  9669. } = select(store_store);
  9670. const {
  9671. getPostType,
  9672. canUser
  9673. } = select(external_wp_coreData_namespaceObject.store);
  9674. const postId = getCurrentPostId();
  9675. const postType = getPostType(getCurrentPostType());
  9676. const resource = (postType === null || postType === void 0 ? void 0 : postType.rest_base) || ''; // eslint-disable-line camelcase
  9677. return {
  9678. isNew: isEditedPostNew(),
  9679. postId,
  9680. canUserDelete: postId && resource ? canUser('delete', resource, postId) : false
  9681. };
  9682. })(PostTrashCheck));
  9683. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-url/index.js
  9684. /**
  9685. * WordPress dependencies
  9686. */
  9687. /**
  9688. * Internal dependencies
  9689. */
  9690. function PostURL(_ref) {
  9691. let {
  9692. onClose
  9693. } = _ref;
  9694. const {
  9695. isEditable,
  9696. postSlug,
  9697. viewPostLabel,
  9698. postLink,
  9699. permalinkPrefix,
  9700. permalinkSuffix
  9701. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  9702. const postTypeSlug = select(store_store).getCurrentPostType();
  9703. const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
  9704. const permalinkParts = select(store_store).getPermalinkParts();
  9705. return {
  9706. isEditable: select(store_store).isPermalinkEditable(),
  9707. postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getEditedPostSlug()),
  9708. viewPostLabel: postType === null || postType === void 0 ? void 0 : postType.labels.view_item,
  9709. postLink: select(store_store).getCurrentPost().link,
  9710. permalinkPrefix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.prefix,
  9711. permalinkSuffix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.suffix
  9712. };
  9713. }, []);
  9714. const {
  9715. editPost
  9716. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  9717. const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false);
  9718. return (0,external_wp_element_namespaceObject.createElement)("div", {
  9719. className: "editor-post-url"
  9720. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
  9721. title: (0,external_wp_i18n_namespaceObject.__)('URL'),
  9722. onClose: onClose
  9723. }), isEditable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  9724. label: (0,external_wp_i18n_namespaceObject.__)('Permalink'),
  9725. value: forceEmptyField ? '' : postSlug,
  9726. autoComplete: "off",
  9727. spellCheck: "false",
  9728. help: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('The last part of the URL.'), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  9729. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/settings-sidebar/#permalink')
  9730. }, (0,external_wp_i18n_namespaceObject.__)('Learn more.'))),
  9731. onChange: newValue => {
  9732. editPost({
  9733. slug: newValue
  9734. }); // When we delete the field the permalink gets
  9735. // reverted to the original value.
  9736. // The forceEmptyField logic allows the user to have
  9737. // the field temporarily empty while typing.
  9738. if (!newValue) {
  9739. if (!forceEmptyField) {
  9740. setForceEmptyField(true);
  9741. }
  9742. return;
  9743. }
  9744. if (forceEmptyField) {
  9745. setForceEmptyField(false);
  9746. }
  9747. },
  9748. onBlur: event => {
  9749. editPost({
  9750. slug: (0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value)
  9751. });
  9752. if (forceEmptyField) {
  9753. setForceEmptyField(false);
  9754. }
  9755. }
  9756. }), isEditable && (0,external_wp_element_namespaceObject.createElement)("h3", {
  9757. className: "editor-post-url__link-label"
  9758. }, viewPostLabel !== null && viewPostLabel !== void 0 ? viewPostLabel : (0,external_wp_i18n_namespaceObject.__)('View post')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  9759. className: "editor-post-url__link",
  9760. href: postLink,
  9761. target: "_blank"
  9762. }, isEditable ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("span", {
  9763. className: "editor-post-url__link-prefix"
  9764. }, permalinkPrefix), (0,external_wp_element_namespaceObject.createElement)("span", {
  9765. className: "editor-post-url__link-slug"
  9766. }, postSlug), (0,external_wp_element_namespaceObject.createElement)("span", {
  9767. className: "editor-post-url__link-suffix"
  9768. }, permalinkSuffix)) : postLink)));
  9769. }
  9770. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-url/check.js
  9771. /**
  9772. * WordPress dependencies
  9773. */
  9774. /**
  9775. * Internal dependencies
  9776. */
  9777. function PostURLCheck(_ref) {
  9778. let {
  9779. children
  9780. } = _ref;
  9781. const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
  9782. const postTypeSlug = select(store_store).getCurrentPostType();
  9783. const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
  9784. if (!(postType !== null && postType !== void 0 && postType.viewable)) {
  9785. return false;
  9786. }
  9787. const post = select(store_store).getCurrentPost();
  9788. if (!post.link) {
  9789. return false;
  9790. }
  9791. const permalinkParts = select(store_store).getPermalinkParts();
  9792. if (!permalinkParts) {
  9793. return false;
  9794. }
  9795. return true;
  9796. }, []);
  9797. if (!isVisible) {
  9798. return null;
  9799. }
  9800. return children;
  9801. }
  9802. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-url/label.js
  9803. /**
  9804. * WordPress dependencies
  9805. */
  9806. /**
  9807. * Internal dependencies
  9808. */
  9809. function PostURLLabel() {
  9810. return usePostURLLabel();
  9811. }
  9812. function usePostURLLabel() {
  9813. const postLink = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getPermalink(), []);
  9814. return (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postLink));
  9815. }
  9816. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js
  9817. /**
  9818. * External dependencies
  9819. */
  9820. /**
  9821. * WordPress dependencies
  9822. */
  9823. /**
  9824. * Internal dependencies
  9825. */
  9826. function PostVisibilityCheck(_ref) {
  9827. let {
  9828. hasPublishAction,
  9829. render
  9830. } = _ref;
  9831. const canEdit = hasPublishAction;
  9832. return render({
  9833. canEdit
  9834. });
  9835. }
  9836. /* harmony default export */ var post_visibility_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  9837. const {
  9838. getCurrentPost,
  9839. getCurrentPostType
  9840. } = select(store_store);
  9841. return {
  9842. hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  9843. postType: getCurrentPostType()
  9844. };
  9845. })])(PostVisibilityCheck));
  9846. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js
  9847. /**
  9848. * WordPress dependencies
  9849. */
  9850. const info = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  9851. xmlns: "http://www.w3.org/2000/svg",
  9852. viewBox: "0 0 24 24"
  9853. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  9854. d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"
  9855. }));
  9856. /* harmony default export */ var library_info = (info);
  9857. ;// CONCATENATED MODULE: external ["wp","wordcount"]
  9858. var external_wp_wordcount_namespaceObject = window["wp"]["wordcount"];
  9859. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js
  9860. /**
  9861. * WordPress dependencies
  9862. */
  9863. /**
  9864. * Internal dependencies
  9865. */
  9866. function WordCount() {
  9867. const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []);
  9868. /*
  9869. * translators: If your word count is based on single characters (e.g. East Asian characters),
  9870. * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
  9871. * Do not translate into your own language.
  9872. */
  9873. const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
  9874. return (0,external_wp_element_namespaceObject.createElement)("span", {
  9875. className: "word-count"
  9876. }, (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType));
  9877. }
  9878. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/time-to-read/index.js
  9879. /**
  9880. * WordPress dependencies
  9881. */
  9882. /**
  9883. * Internal dependencies
  9884. */
  9885. /**
  9886. * Average reading rate - based on average taken from
  9887. * https://irisreading.com/average-reading-speed-in-various-languages/
  9888. * (Characters/minute used for Chinese rather than words).
  9889. *
  9890. * @type {number} A rough estimate of the average reading rate across multiple languages.
  9891. */
  9892. const AVERAGE_READING_RATE = 189;
  9893. function TimeToRead() {
  9894. const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []);
  9895. /*
  9896. * translators: If your word count is based on single characters (e.g. East Asian characters),
  9897. * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
  9898. * Do not translate into your own language.
  9899. */
  9900. const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
  9901. const minutesToRead = Math.round((0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) / AVERAGE_READING_RATE);
  9902. const minutesToReadString = minutesToRead === 0 ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('<span>< 1</span> minute'), {
  9903. span: (0,external_wp_element_namespaceObject.createElement)("span", {
  9904. className: "table-of-contents__number"
  9905. })
  9906. }) : (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(
  9907. /* translators: %s is the number of minutes the post will take to read. */
  9908. (0,external_wp_i18n_namespaceObject._n)('<span>%d</span> minute', '<span>%d</span> minutes', minutesToRead), minutesToRead), {
  9909. span: (0,external_wp_element_namespaceObject.createElement)("span", {
  9910. className: "table-of-contents__number"
  9911. })
  9912. });
  9913. return (0,external_wp_element_namespaceObject.createElement)("span", {
  9914. className: "time-to-read"
  9915. }, minutesToReadString);
  9916. }
  9917. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/character-count/index.js
  9918. /**
  9919. * WordPress dependencies
  9920. */
  9921. /**
  9922. * Internal dependencies
  9923. */
  9924. function CharacterCount() {
  9925. const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []);
  9926. return (0,external_wp_wordcount_namespaceObject.count)(content, 'characters_including_spaces');
  9927. }
  9928. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js
  9929. /**
  9930. * WordPress dependencies
  9931. */
  9932. /**
  9933. * Internal dependencies
  9934. */
  9935. function TableOfContentsPanel(_ref) {
  9936. let {
  9937. hasOutlineItemsDisabled,
  9938. onRequestClose
  9939. } = _ref;
  9940. const {
  9941. headingCount,
  9942. paragraphCount,
  9943. numberOfBlocks
  9944. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  9945. const {
  9946. getGlobalBlockCount
  9947. } = select(external_wp_blockEditor_namespaceObject.store);
  9948. return {
  9949. headingCount: getGlobalBlockCount('core/heading'),
  9950. paragraphCount: getGlobalBlockCount('core/paragraph'),
  9951. numberOfBlocks: getGlobalBlockCount()
  9952. };
  9953. }, []);
  9954. return (
  9955. /*
  9956. * Disable reason: The `list` ARIA role is redundant but
  9957. * Safari+VoiceOver won't announce the list otherwise.
  9958. */
  9959. /* eslint-disable jsx-a11y/no-redundant-roles */
  9960. (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  9961. className: "table-of-contents__wrapper",
  9962. role: "note",
  9963. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document Statistics'),
  9964. tabIndex: "0"
  9965. }, (0,external_wp_element_namespaceObject.createElement)("ul", {
  9966. role: "list",
  9967. className: "table-of-contents__counts"
  9968. }, (0,external_wp_element_namespaceObject.createElement)("li", {
  9969. className: "table-of-contents__count"
  9970. }, (0,external_wp_i18n_namespaceObject.__)('Words'), (0,external_wp_element_namespaceObject.createElement)(WordCount, null)), (0,external_wp_element_namespaceObject.createElement)("li", {
  9971. className: "table-of-contents__count"
  9972. }, (0,external_wp_i18n_namespaceObject.__)('Characters'), (0,external_wp_element_namespaceObject.createElement)("span", {
  9973. className: "table-of-contents__number"
  9974. }, (0,external_wp_element_namespaceObject.createElement)(CharacterCount, null))), (0,external_wp_element_namespaceObject.createElement)("li", {
  9975. className: "table-of-contents__count"
  9976. }, (0,external_wp_i18n_namespaceObject.__)('Time to read'), (0,external_wp_element_namespaceObject.createElement)(TimeToRead, null)), (0,external_wp_element_namespaceObject.createElement)("li", {
  9977. className: "table-of-contents__count"
  9978. }, (0,external_wp_i18n_namespaceObject.__)('Headings'), (0,external_wp_element_namespaceObject.createElement)("span", {
  9979. className: "table-of-contents__number"
  9980. }, headingCount)), (0,external_wp_element_namespaceObject.createElement)("li", {
  9981. className: "table-of-contents__count"
  9982. }, (0,external_wp_i18n_namespaceObject.__)('Paragraphs'), (0,external_wp_element_namespaceObject.createElement)("span", {
  9983. className: "table-of-contents__number"
  9984. }, paragraphCount)), (0,external_wp_element_namespaceObject.createElement)("li", {
  9985. className: "table-of-contents__count"
  9986. }, (0,external_wp_i18n_namespaceObject.__)('Blocks'), (0,external_wp_element_namespaceObject.createElement)("span", {
  9987. className: "table-of-contents__number"
  9988. }, numberOfBlocks)))), headingCount > 0 && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("hr", null), (0,external_wp_element_namespaceObject.createElement)("h2", {
  9989. className: "table-of-contents__title"
  9990. }, (0,external_wp_i18n_namespaceObject.__)('Document Outline')), (0,external_wp_element_namespaceObject.createElement)(document_outline, {
  9991. onSelect: onRequestClose,
  9992. hasOutlineItemsDisabled: hasOutlineItemsDisabled
  9993. })))
  9994. /* eslint-enable jsx-a11y/no-redundant-roles */
  9995. );
  9996. }
  9997. /* harmony default export */ var panel = (TableOfContentsPanel);
  9998. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js
  9999. /**
  10000. * WordPress dependencies
  10001. */
  10002. /**
  10003. * Internal dependencies
  10004. */
  10005. function TableOfContents(_ref, ref) {
  10006. let {
  10007. hasOutlineItemsDisabled,
  10008. repositionDropdown,
  10009. ...props
  10010. } = _ref;
  10011. const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), []);
  10012. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
  10013. position: repositionDropdown ? 'middle right right' : 'bottom',
  10014. className: "table-of-contents",
  10015. contentClassName: "table-of-contents__popover",
  10016. renderToggle: _ref2 => {
  10017. let {
  10018. isOpen,
  10019. onToggle
  10020. } = _ref2;
  10021. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, {
  10022. ref: ref,
  10023. onClick: hasBlocks ? onToggle : undefined,
  10024. icon: library_info,
  10025. "aria-expanded": isOpen,
  10026. "aria-haspopup": "true"
  10027. /* translators: button label text should, if possible, be under 16 characters. */
  10028. ,
  10029. label: (0,external_wp_i18n_namespaceObject.__)('Details'),
  10030. tooltipPosition: "bottom",
  10031. "aria-disabled": !hasBlocks
  10032. }));
  10033. },
  10034. renderContent: _ref3 => {
  10035. let {
  10036. onClose
  10037. } = _ref3;
  10038. return (0,external_wp_element_namespaceObject.createElement)(panel, {
  10039. onRequestClose: onClose,
  10040. hasOutlineItemsDisabled: hasOutlineItemsDisabled
  10041. });
  10042. }
  10043. });
  10044. }
  10045. /* harmony default export */ var table_of_contents = ((0,external_wp_element_namespaceObject.forwardRef)(TableOfContents));
  10046. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js
  10047. /**
  10048. * WordPress dependencies
  10049. */
  10050. /**
  10051. * Warns the user if there are unsaved changes before leaving the editor.
  10052. * Compatible with Post Editor and Site Editor.
  10053. *
  10054. * @return {WPComponent} The component.
  10055. */
  10056. function UnsavedChangesWarning() {
  10057. const isDirty = (0,external_wp_data_namespaceObject.useSelect)(select => {
  10058. return () => {
  10059. const {
  10060. __experimentalGetDirtyEntityRecords
  10061. } = select(external_wp_coreData_namespaceObject.store);
  10062. const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
  10063. return dirtyEntityRecords.length > 0;
  10064. };
  10065. }, []);
  10066. /**
  10067. * Warns the user if there are unsaved changes before leaving the editor.
  10068. *
  10069. * @param {Event} event `beforeunload` event.
  10070. *
  10071. * @return {?string} Warning prompt message, if unsaved changes exist.
  10072. */
  10073. const warnIfUnsavedChanges = event => {
  10074. // We need to call the selector directly in the listener to avoid race
  10075. // conditions with `BrowserURL` where `componentDidUpdate` gets the
  10076. // new value of `isEditedPostDirty` before this component does,
  10077. // causing this component to incorrectly think a trashed post is still dirty.
  10078. if (isDirty()) {
  10079. event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.');
  10080. return event.returnValue;
  10081. }
  10082. };
  10083. (0,external_wp_element_namespaceObject.useEffect)(() => {
  10084. window.addEventListener('beforeunload', warnIfUnsavedChanges);
  10085. return () => {
  10086. window.removeEventListener('beforeunload', warnIfUnsavedChanges);
  10087. };
  10088. }, []);
  10089. return null;
  10090. }
  10091. ;// CONCATENATED MODULE: external ["wp","reusableBlocks"]
  10092. var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"];
  10093. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js
  10094. /**
  10095. * WordPress dependencies
  10096. */
  10097. /**
  10098. * Internal dependencies
  10099. */
  10100. const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => (0,external_wp_data_namespaceObject.withRegistry)(props => {
  10101. const {
  10102. useSubRegistry = true,
  10103. registry,
  10104. ...additionalProps
  10105. } = props;
  10106. if (!useSubRegistry) {
  10107. return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, additionalProps);
  10108. }
  10109. const [subRegistry, setSubRegistry] = (0,external_wp_element_namespaceObject.useState)(null);
  10110. (0,external_wp_element_namespaceObject.useEffect)(() => {
  10111. const newRegistry = (0,external_wp_data_namespaceObject.createRegistry)({
  10112. 'core/block-editor': external_wp_blockEditor_namespaceObject.storeConfig
  10113. }, registry);
  10114. newRegistry.registerStore('core/editor', storeConfig);
  10115. setSubRegistry(newRegistry);
  10116. }, [registry]);
  10117. if (!subRegistry) {
  10118. return null;
  10119. }
  10120. return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.RegistryProvider, {
  10121. value: subRegistry
  10122. }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, additionalProps));
  10123. }), 'withRegistryProvider');
  10124. /* harmony default export */ var with_registry_provider = (withRegistryProvider);
  10125. ;// CONCATENATED MODULE: external ["wp","mediaUtils"]
  10126. var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
  10127. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js
  10128. /**
  10129. * WordPress dependencies
  10130. */
  10131. /**
  10132. * Internal dependencies
  10133. */
  10134. const media_upload_noop = () => {};
  10135. /**
  10136. * Upload a media file when the file upload button is activated.
  10137. * Wrapper around mediaUpload() that injects the current post ID.
  10138. *
  10139. * @param {Object} $0 Parameters object passed to the function.
  10140. * @param {?Object} $0.additionalData Additional data to include in the request.
  10141. * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.
  10142. * @param {Array} $0.filesList List of files.
  10143. * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.
  10144. * @param {Function} $0.onError Function called when an error happens.
  10145. * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.
  10146. */
  10147. function mediaUpload(_ref) {
  10148. let {
  10149. additionalData = {},
  10150. allowedTypes,
  10151. filesList,
  10152. maxUploadFileSize,
  10153. onError = media_upload_noop,
  10154. onFileChange
  10155. } = _ref;
  10156. const {
  10157. getCurrentPostId,
  10158. getEditorSettings
  10159. } = (0,external_wp_data_namespaceObject.select)(store_store);
  10160. const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;
  10161. maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize;
  10162. (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({
  10163. allowedTypes,
  10164. filesList,
  10165. onFileChange,
  10166. additionalData: {
  10167. post: getCurrentPostId(),
  10168. ...additionalData
  10169. },
  10170. maxUploadFileSize,
  10171. onError: _ref2 => {
  10172. let {
  10173. message
  10174. } = _ref2;
  10175. return onError(message);
  10176. },
  10177. wpAllowedMimeTypes
  10178. });
  10179. }
  10180. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js
  10181. /**
  10182. * External dependencies
  10183. */
  10184. /**
  10185. * WordPress dependencies
  10186. */
  10187. /**
  10188. * Internal dependencies
  10189. */
  10190. /**
  10191. * React hook used to compute the block editor settings to use for the post editor.
  10192. *
  10193. * @param {Object} settings EditorProvider settings prop.
  10194. * @param {boolean} hasTemplate Whether template mode is enabled.
  10195. *
  10196. * @return {Object} Block Editor Settings.
  10197. */
  10198. function useBlockEditorSettings(settings, hasTemplate) {
  10199. var _settings$__experimen, _settings$__experimen2;
  10200. const {
  10201. reusableBlocks,
  10202. hasUploadPermissions,
  10203. canUseUnfilteredHTML,
  10204. userCanCreatePages,
  10205. pageOnFront,
  10206. postType
  10207. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  10208. var _canUser;
  10209. const {
  10210. canUserUseUnfilteredHTML,
  10211. getCurrentPostType
  10212. } = select(store_store);
  10213. const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
  10214. const {
  10215. canUser,
  10216. getEntityRecord
  10217. } = select(external_wp_coreData_namespaceObject.store);
  10218. const siteSettings = canUser('read', 'settings') ? getEntityRecord('root', 'site') : undefined;
  10219. return {
  10220. canUseUnfilteredHTML: canUserUseUnfilteredHTML(),
  10221. reusableBlocks: isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', {
  10222. per_page: -1
  10223. }) : [],
  10224. // Reusable blocks are fetched in the native version of this hook.
  10225. hasUploadPermissions: (_canUser = canUser('create', 'media')) !== null && _canUser !== void 0 ? _canUser : true,
  10226. userCanCreatePages: canUser('create', 'pages'),
  10227. pageOnFront: siteSettings === null || siteSettings === void 0 ? void 0 : siteSettings.page_on_front,
  10228. postType: getCurrentPostType()
  10229. };
  10230. }, []);
  10231. const settingsBlockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : // WP 6.0
  10232. settings.__experimentalBlockPatterns; // WP 5.9
  10233. const settingsBlockPatternCategories = (_settings$__experimen2 = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen2 !== void 0 ? _settings$__experimen2 : // WP 6.0
  10234. settings.__experimentalBlockPatternCategories; // WP 5.9
  10235. const {
  10236. restBlockPatterns,
  10237. restBlockPatternCategories
  10238. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  10239. restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(),
  10240. restBlockPatternCategories: select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()
  10241. }), []);
  10242. const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(_ref => {
  10243. let {
  10244. postTypes
  10245. } = _ref;
  10246. return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType);
  10247. }), [settingsBlockPatterns, restBlockPatterns, postType]);
  10248. const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]);
  10249. const {
  10250. undo
  10251. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  10252. const {
  10253. saveEntityRecord
  10254. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  10255. /**
  10256. * Creates a Post entity.
  10257. * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.
  10258. *
  10259. * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.
  10260. * @return {Object} the post type object that was created.
  10261. */
  10262. const createPageEntity = options => {
  10263. if (!userCanCreatePages) {
  10264. return Promise.reject({
  10265. message: (0,external_wp_i18n_namespaceObject.__)('You do not have permission to create Pages.')
  10266. });
  10267. }
  10268. return saveEntityRecord('postType', 'page', options);
  10269. };
  10270. return (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(0,external_lodash_namespaceObject.pick)(settings, ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'hasReducedUI', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets']),
  10271. mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
  10272. __experimentalReusableBlocks: reusableBlocks,
  10273. __experimentalBlockPatterns: blockPatterns,
  10274. __experimentalBlockPatternCategories: blockPatternCategories,
  10275. __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings),
  10276. __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData,
  10277. __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
  10278. __experimentalUndo: undo,
  10279. outlineMode: hasTemplate,
  10280. __experimentalCreatePageEntity: createPageEntity,
  10281. __experimentalUserCanCreatePages: userCanCreatePages,
  10282. pageOnFront,
  10283. __experimentalPreferPatternsOnRoot: hasTemplate
  10284. }), [settings, hasUploadPermissions, reusableBlocks, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, hasTemplate, userCanCreatePages, pageOnFront]);
  10285. }
  10286. /* harmony default export */ var use_block_editor_settings = (useBlockEditorSettings);
  10287. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js
  10288. /**
  10289. * WordPress dependencies
  10290. */
  10291. /**
  10292. * Internal dependencies
  10293. */
  10294. function EditorProvider(_ref) {
  10295. let {
  10296. __unstableTemplate,
  10297. post,
  10298. settings,
  10299. recovery,
  10300. initialEdits,
  10301. children
  10302. } = _ref;
  10303. const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => {
  10304. if (post.type === 'wp_template') {
  10305. return {};
  10306. }
  10307. return {
  10308. postId: post.id,
  10309. postType: post.type
  10310. };
  10311. }, [post.id, post.type]);
  10312. const {
  10313. selection,
  10314. isReady
  10315. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  10316. const {
  10317. getEditorSelection,
  10318. __unstableIsEditorReady
  10319. } = select(store_store);
  10320. return {
  10321. isReady: __unstableIsEditorReady(),
  10322. selection: getEditorSelection()
  10323. };
  10324. }, []);
  10325. const {
  10326. id,
  10327. type
  10328. } = __unstableTemplate !== null && __unstableTemplate !== void 0 ? __unstableTemplate : post;
  10329. const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', type, {
  10330. id
  10331. });
  10332. const editorSettings = use_block_editor_settings(settings, !!__unstableTemplate);
  10333. const {
  10334. updatePostLock,
  10335. setupEditor,
  10336. updateEditorSettings,
  10337. __experimentalTearDownEditor
  10338. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  10339. const {
  10340. createWarningNotice
  10341. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); // Initialize and tear down the editor.
  10342. // Ideally this should be synced on each change and not just something you do once.
  10343. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  10344. // Assume that we don't need to initialize in the case of an error recovery.
  10345. if (recovery) {
  10346. return;
  10347. }
  10348. updatePostLock(settings.postLock);
  10349. setupEditor(post, initialEdits, settings.template);
  10350. if (settings.autosave) {
  10351. createWarningNotice((0,external_wp_i18n_namespaceObject.__)('There is an autosave of this post that is more recent than the version below.'), {
  10352. id: 'autosave-exists',
  10353. actions: [{
  10354. label: (0,external_wp_i18n_namespaceObject.__)('View the autosave'),
  10355. url: settings.autosave.editLink
  10356. }]
  10357. });
  10358. }
  10359. return () => {
  10360. __experimentalTearDownEditor();
  10361. };
  10362. }, []); // Synchronize the editor settings as they change.
  10363. (0,external_wp_element_namespaceObject.useEffect)(() => {
  10364. updateEditorSettings(settings);
  10365. }, [settings]);
  10366. if (!isReady) {
  10367. return null;
  10368. }
  10369. return (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
  10370. kind: "root",
  10371. type: "site"
  10372. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
  10373. kind: "postType",
  10374. type: post.type,
  10375. id: post.id
  10376. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
  10377. value: defaultBlockContext
  10378. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, {
  10379. value: blocks,
  10380. onChange: onChange,
  10381. onInput: onInput,
  10382. selection: selection,
  10383. settings: editorSettings,
  10384. useSubRegistry: false
  10385. }, children, (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, null)))));
  10386. }
  10387. /* harmony default export */ var provider = (with_registry_provider(EditorProvider));
  10388. ;// CONCATENATED MODULE: external ["wp","serverSideRender"]
  10389. var external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"];
  10390. var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject);
  10391. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js
  10392. // Block Creation Components.
  10393. /**
  10394. * WordPress dependencies
  10395. */
  10396. function deprecateComponent(name, Wrapped) {
  10397. let staticsToHoist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  10398. const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
  10399. external_wp_deprecated_default()('wp.editor.' + name, {
  10400. since: '5.3',
  10401. alternative: 'wp.blockEditor.' + name,
  10402. version: '6.2'
  10403. });
  10404. return (0,external_wp_element_namespaceObject.createElement)(Wrapped, _extends({
  10405. ref: ref
  10406. }, props));
  10407. });
  10408. staticsToHoist.forEach(staticName => {
  10409. Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]);
  10410. });
  10411. return Component;
  10412. }
  10413. function deprecateFunction(name, func) {
  10414. return function () {
  10415. external_wp_deprecated_default()('wp.editor.' + name, {
  10416. since: '5.3',
  10417. alternative: 'wp.blockEditor.' + name,
  10418. version: '6.2'
  10419. });
  10420. return func(...arguments);
  10421. };
  10422. }
  10423. const RichText = deprecateComponent('RichText', external_wp_blockEditor_namespaceObject.RichText, ['Content']);
  10424. RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_namespaceObject.RichText.isEmpty);
  10425. const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_namespaceObject.Autocomplete);
  10426. const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_namespaceObject.AlignmentToolbar);
  10427. const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar);
  10428. const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_namespaceObject.BlockControls, ['Slot']);
  10429. const BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_namespaceObject.BlockEdit);
  10430. const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts);
  10431. const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_namespaceObject.BlockFormatControls, ['Slot']);
  10432. const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_namespaceObject.BlockIcon);
  10433. const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_namespaceObject.BlockInspector);
  10434. const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_namespaceObject.BlockList);
  10435. const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_namespaceObject.BlockMover);
  10436. const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_namespaceObject.BlockNavigationDropdown);
  10437. const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_namespaceObject.BlockSelectionClearer);
  10438. const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_namespaceObject.BlockSettingsMenu);
  10439. const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_namespaceObject.BlockTitle);
  10440. const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_namespaceObject.BlockToolbar);
  10441. const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_namespaceObject.ColorPalette);
  10442. const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_namespaceObject.ContrastChecker);
  10443. const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_namespaceObject.CopyHandler);
  10444. const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_namespaceObject.DefaultBlockAppender);
  10445. const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_namespaceObject.FontSizePicker);
  10446. const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_namespaceObject.Inserter);
  10447. const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_namespaceObject.InnerBlocks, ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']);
  10448. const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, ['Slot']);
  10449. const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_namespaceObject.InspectorControls, ['Slot']);
  10450. const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_namespaceObject.PanelColorSettings);
  10451. const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_namespaceObject.PlainText);
  10452. const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_namespaceObject.RichTextShortcut);
  10453. const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_namespaceObject.RichTextToolbarButton);
  10454. const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent);
  10455. const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_namespaceObject.MediaPlaceholder);
  10456. const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_namespaceObject.MediaUpload);
  10457. const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_namespaceObject.MediaUploadCheck);
  10458. const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView);
  10459. const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_namespaceObject.NavigableToolbar);
  10460. const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_namespaceObject.ObserveTyping);
  10461. const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_namespaceObject.SkipToSelectedBlock);
  10462. const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_namespaceObject.URLInput);
  10463. const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_namespaceObject.URLInputButton);
  10464. const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_namespaceObject.URLPopover);
  10465. const Warning = deprecateComponent('Warning', external_wp_blockEditor_namespaceObject.Warning);
  10466. const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_namespaceObject.WritingFlow);
  10467. const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_namespaceObject.createCustomColorsHOC);
  10468. const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_namespaceObject.getColorClassName);
  10469. const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues);
  10470. const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_namespaceObject.getColorObjectByColorValue);
  10471. const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_namespaceObject.getFontSize);
  10472. const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_namespaceObject.getFontSizeClass);
  10473. const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_namespaceObject.withColorContext);
  10474. const withColors = deprecateFunction('withColors', external_wp_blockEditor_namespaceObject.withColors);
  10475. const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_namespaceObject.withFontSizes);
  10476. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js
  10477. // Block Creation Components.
  10478. // Post Related Components.
  10479. // State Related Components.
  10480. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js
  10481. /**
  10482. * WordPress dependencies
  10483. */
  10484. /**
  10485. * Performs some basic cleanup of a string for use as a post slug
  10486. *
  10487. * This replicates some of what sanitize_title() does in WordPress core, but
  10488. * is only designed to approximate what the slug will be.
  10489. *
  10490. * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters.
  10491. * Removes combining diacritical marks. Converts whitespace, periods,
  10492. * and forward slashes to hyphens. Removes any remaining non-word characters
  10493. * except hyphens and underscores. Converts remaining string to lowercase.
  10494. * It does not account for octets, HTML entities, or other encoded characters.
  10495. *
  10496. * @param {string} string Title or slug to be processed
  10497. *
  10498. * @return {string} Processed string
  10499. */
  10500. function cleanForSlug(string) {
  10501. external_wp_deprecated_default()('wp.editor.cleanForSlug', {
  10502. since: '12.7',
  10503. plugin: 'Gutenberg',
  10504. alternative: 'wp.url.cleanForSlug'
  10505. });
  10506. return (0,external_wp_url_namespaceObject.cleanForSlug)(string);
  10507. }
  10508. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js
  10509. /**
  10510. * Internal dependencies
  10511. */
  10512. ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js
  10513. /**
  10514. * Internal dependencies
  10515. */
  10516. /*
  10517. * Backward compatibility
  10518. */
  10519. }();
  10520. (window.wp = window.wp || {}).editor = __webpack_exports__;
  10521. /******/ })()
  10522. ;